'My password_verify for a value from database always return false

include("src/database.php");#this included file works wll
$query=mysqli_query($conn,"SELECT * FROM students limit 1");
$data=mysqli_fetch_assoc($query);
echo "my hased data id ".$data["password"]." and Actual password is 12345678 <br />";

if(password_verify("12345678",$data["password"])){
    echo "Finally this worked";
}else{
    echo "THIS ALWAYS EXECUTES";
}

#now i cannot hardcode the data it sees it as a varaible inside of a string since it contains multiple $s
#this is the hashed data $2y$10$S/HjSwqh8QIjc

Another problem is that I can't hardcode the value into a variable. It conatins multiple $s so it sees them as another variable in a string. What should I do about this?



Solution 1:[1]

As you said in the comments you store the password in a column with a mac length of 10. If you read the documentation of the password_hash function you will see the column length need to be at least 72 characters long.

So changing the max length of your column will probably solve your problem

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Baracuda078