I've written this code to update a user's password, and it seems to be posting according to the echo, but when trying to log in, neither the new or old password work! need a hand with this, here's the code:
if(isset($_POST['confirmReset'])){
$q = "SELECT * FROM user WHERE email = '".$_POST['email']."'";
$resObj = mysqli_query($conn, $q);
$rowcount=mysqli_num_rows($resObj);
//var_dump($rowcount);
if ($rowcount == 1) {
$q = "UPDATE user SET password = '".md5($password)."' WHERE email = '".$_POST['email']."'";
if (mysqli_query($conn, $q)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
$rowcount=mysqli_num_rows($resObj);
} else {
}
var_dump($_POST);
}