I have this function or method in my class, but it doesn't return number of rows when I insert an email into it. I have tested the mysql connection etc, they all are working. Also note that the email that I am passing through the method already exist in database. my plan is to get the number of the rows and if it is bigger than zero, it means we already have this email in database.
public function userExist($email) {
$query = "SELECT email FROM " . USER_TABLE . " WHERE email = ?";
$stmt = $this->_db->prepare($query);
$stmt->bind_param("s", $email);
if ($stmt->execute()) {
$stmt->store_result();
return $stmt->num_rows;
}
return false;
}