I am fetching data from the database like this
while ($row = mysqli_fetch_array($select_user_query)){
$userId = $row ['id'];
$check_email = $row ['userEmail'];
$check_password = $row ['userPassword'];
}
and then I compare if the entered details match the details fetched from the db.
if ($email === $check_email || $hashed_password === $check_password) {
// header ("Location:../dashboard.php");
echo "success";
} else {
// header ("Location: ../signup.php");
echo "failed";
}
but the problem is, if the email address entered doesn't exist in the database, it returns error
Notice: Undefined variable: check_email in C:\xampp2\htdocs\honest\includes\login_process.php on line 37
However if the email exists, then it returns success.
So the questions is, what is the best practice here? Should I set default value to $check_email
if it's empty?