PHP script to check no record found

If no record found for a particular condition, you can display message to the users. The code as below

1
2
3
4
5
6
7
8
$sql="SELECT * FROM user WHERE email = '$email'";  
$result=mysql_query($sql);
$num=mysql_numrows($result);
 
if ($num > 0)
  echo "found something";
else
  echo "no record found";

Leave a Reply

Your email address will not be published. Required fields are marked *