Checking if user's email address matches any existing email addresses in
database
I have a form that requires a user to enter their email address in order
to receive a password reset email. I'm trying to compare the email to
existing emails in the database before sending the email; if the email
doesn't exist, the script should not send the reset email.
The error I get is: 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 '@rocketmail.com' at line 1 SQL: SELECT customer_id FROM customer
WHERE customer_email = user@rocketmail.com
$sql = "SELECT customer_id FROM customer WHERE customer_email =
".$_POST['email'];
$result = mysqli_query($db, $sql) or die(mysqli_error($db)."<br />SQL:
$sql");
$num_rows = mysql_num_rows($result);
if($num_rows < 1) {
$problem = TRUE;
$error_message .= '<p class="errorctr">Email was not found in our
database.</p>';
}
No comments:
Post a Comment