tdrsam tdrsam - 4 months ago 17
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

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.

Comments