tdrsam tdrsam - 1 year ago 75
MySQL Question

MySql statement - enclosing variables

How do I make this statement correct:

$sel= "SELECT * FROM users WHERE email='$em' and password='AES_ENCRYPT("'$psw'","'SecretKey'")'";

I keep getting a parse error of an unexpected T_VARIABLE. Is it the quote marks enclosing the variables in the password section of the statement?

Answer Source

Try these:

$sel= "SELECT * FROM users WHERE email='$em' and password=AES_ENCRYPT('$psw','SecretKey')";

AES_ENCRYPT is a MySQL function, so no need to add quotes, just the variables.