Storing encrypted data in a database with
| From: | Jay Blanchard | Date: | Tue, 23 Mar 2004 22:04:38 +0000 |
| Subject: | Storing encrypted data in a database with | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-181319@lists.php.net to get a copy of this message | ||
Good afternoon!
I am storing some encrypted data using PHP to do the encryption and a MySQL database. I have
encountered a couple of times where I get back a query sytax error.
INSERT INTO
test.tblEncTest (encAlg, encMode,
encIV, reqName, reqSSN, reqEMail) VALUES (
'blowfish', 'cbc', '–3I®¼}ñÀ', 'Î ÑpÎ_9',
'‘ˆký¬fè×?Q½þgÖ·', '-›%·+AœêR'—HX‹ýÚÈppT Äþì7
GH©ŽŒÕõý' )
You have an error in your SQL syntax near 'HX‹ýÚÈppT Äþì7 GH©ŽŒÕõý' )
' at line 1
Now, if you look closely you can see and additional single quote in êR'—HX‹. I cannot use
addslashes() here can I? Or should I base64_encode each item and then decode on the way back out.
Any thoughts would be appreciated.
TVMIA!