What are common mistakes to avoid when comparing passwords stored in a database with user input in PHP?

When comparing passwords stored in a database with user input in PHP, a common mistake to avoid is not using a secure method like password_hash() and password_verify(). It is important to hash the user input password before comparing it with the hashed password stored in the database to ensure security.

// Retrieve the hashed password from the database
$hashed_password = $row['password'];

// Verify the user input password
if (password_verify($user_input_password, $hashed_password)) {
    // Passwords match
    echo "Password is correct";
} else {
    // Passwords do not match
    echo "Password is incorrect";
}