I created registration form with hashed password and now I am not really sure how to fetch the hashed password and be able to login.
Registration.php
$hash = password_hash($password, PASSWORD_BCRYPT);
$insert = $con->query("INSERT INTO Client (firstName, lastName, email, password, keyVerification) VALUES
('$firstName', '$lastName', '$email', '$hash', '$keyVerification')");
Login.php
$email = $con->real_escape_string($_POST['email']);
$password = $con->real_escape_string($_POST['password']);
$hash = password_hash($password, PASSWORD_BCRYPT);
$result = $con->query("SELECT * FROM Client WHERE email = '$email' AND password = '$hash' LIMIT 1");
Unfortunately this way doesn't work when I want to login with registered email and password - I am just getting error I set up of incorrect password or email. I believe I am making the mistake with hashed password. Where my logic failed ?