Forum Moderators: coopster
$result = mysql_query("SELECT * FROM table WHERE name LIKE '%$name%' and num LIKE '%num%'");
while($row = mysql_fetch_array($result))
$id = $row['sysid'];
My question is, what if no match is found? What will be the value of $id? null?
How do I test for no match?
Thanks! KP
$results='';
$result = mysql_query("SELECT * FROM table WHERE name LIKE '%$name%' and num LIKE '%num%'");
while($row = mysql_fetch_array($result)) {
$id = $row['sysid'];
$results .= "<li> $id </li>\n";
}
if ($results != '') {
// output
}
else {
print "<p>No records found. <a href="add.php">Add one</a></p>\n";
}