im trying to get the password_hash function working for my newly created website but in my database i keep getting a blank result in the password section, this then results in my accounts not having any form of password so it will not log in is there something i have done wrong in this, here is my code and my verification code.
<?php
if(isset($_POST['Register'])) {
session_start();
$FName = $_POST['First_Name'];
$LName = $_POST['Last_Name'];
$Email = $_POST['Email'];
$PW = $_POST['Password'];
$StorePass = password_hash($PW, PASSWORD_BCRYT, array('cost' => 10));
$sql = $con->query("INSERT INTO `lpg-user-db` (Fname, Lname, Email, Password)Values('{$FName}', '{$LName}', '{$Email}', '{$StorePass}')");
header('Location: Login.php');
}
?>
Verification code :
<?php
if(isset($_POST['Login'])) {
$EM = $_POST['email'];
$PW = $_POST['password'];
$result = $con->query("select * from `lpg-user-db` where Email='$EM'");
$row = $result->fetch_array(MYSQLI_BOTH);
if(password_verify($PW, $row['Password'] )) {
session_start();
$_SESSION["UserID"] = $row['UserID'];
header('Location: Account.php');
}else{
session_start();
$_SESSION["LoginFail"] = "Yes";
}
}
?>