I am trying to check if entry belongs to database or not.
$result = mysql_query("SELECT Lot# FROM data WHERE Lot#='$batch'");
if(mysql_num_rows($result) == 0) {
echo "Batch# does not exist. please enter a valid batch#";
}
else {
header("Location: http://localhost/EasyTrack/std Order1.php"); /* Redirect browser */
}
What happens, in both cases, if entry belongs or does not belong to database it shows:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\EasyTrack\StdOrderUpdate.php on line 28 Batch# does not exist. please enter a valid batch#
Is my way of checking correct? if not what's a better way to do so?