I've started using the password_hash() for password hashing. The problem I'm having is that when I use the password_verify() to check if input value matches the hashed passwords stored in the database, every time it returns me false.
$password = "test";
$query = "SELECT password FROM user WHERE password = :pass ";
$statement = $connection->prepare($query);
$statement->bindParam(":pass", $password);
$statement->execute();
if(password_verify($password, $row['password'])){
echo "Password Valid";
}
else {
echo "Invalid Password";
}
However, if for e.g I copy a single hashed password value from the database and put it in the place of $row['password'] and when I test the code, it returns me true.
if(password_verify($password, '$2y$10$kc09i9YSP.ExmUquMqRnf......')){
echo "Password Valid";
}
Help please.