tdrsam tdrsam - 3 months ago 5x
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?


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.