I am building just a very simple login service in PHP, the database query is returning false every single time. I have added email addresses into the users table in my database using phpmyadmin, but when I enter one of the email addresses into the field and push submit, the query goes to the database and comes back false every time.
here is the code:
//queries the database and checks if the email address exists
$result = mysqli_query($connection, "SELECT * FROM 'users' WHERE 'Email'='$email'");
if ($result == FALSE){
die("The account for <i>$email</i> doesn't not exist!");
}
I know that the email variable from the form is correct because it gets printed out as an error. I also know that the email address in the database matches it exactly. The query however only returns false.
Thank you for your help.
'Email', to another string (the email address), and they do not match. Remove the'aroundEmail, or use backticks instead (top, left of the keyboard, next to the1key). The backticks are only required, though, if you have a column with a reserved word (usingdateis a common mistake) or if there's a space in the column (both bad ideas).FROM 'users'. You're mistaking backticks for single-quotes; these are not the same in a query. If you were displaying the error on the query, you would have probably seen an error on this one.