I'm always getting USER_PASSWORD_DO_NOT_MATCH;
returned even when mysql paramaters are correct, here's my code. I'm guessing it has to do with the if else
logic.
NB: In my database the login credentials I pass to this function are correct i.e the password
and $uniNum
public function userLogin($uniNum, $pass){
$password = md5($pass);
error_reporting(E_ALL);
ini_set('display_errors', 1);
$stmt = $this->con->prepare("SELECT id FROM users WHERE uniNum = ? AND password = ?");
echo $this->con->error;
$stmt->bind_param("ss",$uniNum,$password);
if($stmt->execute()){
$stmt->store_result();
if ($stmt->num_rows == 1 ){
echo $stmt->num_rows;
return USER_AUTHENTICATED;
} else {
echo $stmt->num_rows;
return USER_PASSWORD_DO_NOT_MATCH;
}
}else{
echo $stmt->num_rows;
return USER_NOT_FOUND;
}
return $stmt->num_rows;
}