Question : PHP sql sentence error

Dear experts, I have an error message
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ..

$result = mysql_query("SELECT * FROM Mytable where Email=$email and Confirmation=$ConfirmationCode")
or die(mysql_error());  

if (mysql_num_rows($result)  == 0)
{
  //header ('Location: http://www.example.com/');
}
else
{
"UPDATE Mytable SET Approve=1 WHERE Email='$email'"
or die(mysql_error());  
}

Answer : PHP sql sentence error

SELECT * FROM Mytable where Email='$email' and Confirmation=$ConfirmationCode

Try enclosing $email in quotes & if confirmationcode is not int then enclose that too & try.

Do let know if that works for you

Random Solutions  
 
programming4us programming4us