How do I compare hashed passwords that are stored in the database to a user inputted password, I need to do thsi so that the user could log in.
Here's how I hashed my password (using phps crypt method)
$hashedpass = crypt($password);
$sql = "INSERT INTO accounts (username,password,email) VALUES('{$username}','{$hashedpass}','{$email}')";
$conn->query($sql);
This is how I compare them to user input
$username = trim($_POST['username']);
$password = crypt($_POST['password']);
$sql = "SELECT * FROM accounts WHERE username = '{$username}' && password = '{$password }'LIMIT 1";
echo "$sql";
$rs = $conn->query($sql);
$numRows = $rs->num_rows;
if($numRows == 1){
echo "you may log in";
}
I am 100% sure that I enterd the password correctly but the thing is mysql is not showing results,