tdrsam tdrsam - 8 months ago 48
MySQL Question

encrypting multiple variables with AES_ENCRYPT in MySqli

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.


You have wrong SQL,

Try this:

INSERT INTO users (email, password) VALUES (