I have been trying this query from long time but this query returns nothing, or let say rowCount returns 0 and if i try to fetchAll and prints it gives me empty array
public function Login($email, $password)
{
$stmt = $this->pdo->prepare("SELECT user_id from users where email = :email AND password = :password");
$stmt->bindParam(":email", $email, PDO::PARAM_STR);
$stmt->bindParam(":password", $password, PDO::PARAM_STR);
$stmt->execute();
$user = $stmt->fetch(PDO::FETCH_OBJ);
$count = $stmt->rowCount();
if($count >0){
$_SESSION['user_id'] = $user->user_id;
header('Location:home.php');
}else{
return false;
}
}