I get a password from database and it is stored in the $password
variable with "" (Double quotes). I want to change the $password
variable value with '' (single quotes). How can I change this? When I test with a static value, $password = '$2y$10$wFgLkiJbc7MQ0aY6H7bZwehm45CFlvpSBvZmHs9m8euqPmDlP0mIK';
it is ok and the password is valid. My problem is look like this link.
php password_hash and password_verify issues no match
How to solve $password?
$password = $result['Password'];
This is my code:
$get_email = $_POST['email'];
$get_password = $_POST['password'];
$result = $conn->prepare("select * from user where Email='$get_email'");
$result->execute();
foreach ($result as $result) {
$id = $result['ID'];
$password = $result['Password'];
if (password_verify($get_password, $password)) {
echo 'Password is valid!';
} else {
echo 'Invalid password.';
}
}