When I use this code everything works fine, I can login
function pass($user,$pass){
return password_hash("$user-$pass", PASSWORD_BCRYPT, ['cost' => 12]);
}
However if I try to update with this code, it fails for some reason, any ideas?
function updatePassword(){
$res = true;
$stmt = $this->db->prepare("UPDATE users
SET encodedpassword= ?
WHERE username = ?");
try{
$password = password_hash($_POST['newPassword'], PASSWORD_BCRYPT, ['cost' => 12]);
$stmt->execute([$password, $_SESSION['username']]);
} catch (Exception $e) {
$res = $e->getMessage();
}
return $res;
}