tdrsam tdrsam - 2 years ago 94
SQL Question

encrypting multiple variables with AES_ENCRYPT in MySql

What's the correct syntax for a SQL statement like this:

$insert = ("INSERT INTO users (email, password) VALUES (1,AES_ENCRYPT('$email',UNHEX('F3229A0B371ED2D9441B830D21A390C3'))),(1,AES_ENCRYPT('$password',UNHEX('F3229A0B371ED2D9441B830D21A390C3')));");

I'm trying to add two variables to the same row of a db, both of them encrypted. The
variables are inputs from a web form, but you probably guessed that. I get an error message saying there's an unexpected comma which must be the one between the two values.

Answer Source

You have wrong SQL,

Try this:

INSERT INTO users (email, password) VALUES (
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download