I have the password for the login part, which uses $hash = password_hash($password, PASSWORD_DEFAULT);
The password is stored in the database as a hash, $2y$10$CaQON5WOEHcla58aBoIRKOmyYLBwtDHKFqk81y25.EGvjBqlF0W1W
I query the database on the login page and check that the user email is in the database, which it is.
I have checked in MySQL workbench if the query I used works, and it returns the password fine.
However, when I try to query the database for the password and assign it to a variable, I get an error when echoing that the variable is not a string.
I've tried $verify = password_verify($password, $hash); however, the error I also get is parameter 2 must be a string.
So why is the value not a string after I get it? and how do I retrieve the correct value?
Here is my query:
$sql_e2 = "SELECT password FROM users WHERE email='$email'";
$hash = mysqli_query($mysqli, $sql_e2);
Thanks
$hash = mysqli_query($mysqli, $sql_e2);the variable $hash would be a boolean - you need tofetchthe results before assigning the variable$emaildirectly in the sql cmd - useprepared statementswhen using user supplied data