I have a simple PHP file in which I check if the users email exists in my database using the following code:
   $query = "SELECT * FROM userData WHERE email = '$email'";
   $result = mysql_query($query);
Which works perfectly fine when the user enters an email address that is in the database, however, when I want to determine if this $query is null or empty - I'm not sure which one though.
When I enter an email that isn't in the database and add the following code in below:
    if(is_null($result)){
    echo 'email not in database';
    }
the code in the {} isn't executed.
I was just wondering if you could help me out.
Hi again,
Sorry for the duplicating another post. I corrected it by using:
if(mysqli_num_rows($result) > 0)
{ 
  // a row with email exists 
} 
else 
{
  // no row with particular email exists 
}
 
     
     
     
    