I am having problems verifying a password stored in a mySQL database using password_hash. The insert query takes values from a form
query = "INSERT INTO users (email, password, diary) VALUES ('"
.mysqli_real_escape_string($link, $_POST['email'])."', '"
.password_hash(mysqli_real_escape_string($link, $_POST['password']), PASSWORD_DEFAULT)."', '"
.mysqli_real_escape_string($link, $_POST['password'])."')";
When I try to verify it using
if(password_verify(mysqli_real_escape_string($link, $_POST['password'], $row['password']))) {
it always comes out as invalid password, even though I know I am entering it correctly.
Can anyone help please?