I want to be able to perform a search and if no records are found display a particular message otherwise display the found info. Is there a way I can say if $MySQLQuery contains nothing then ELSE. e.g. $MySQLQuery = mysql_query($SQL) or die(mysql_error()); IF ($MySQLQuery == ""){ $string_content = "<TR><TD width='25%' colspan='4'>no records found</TD></TR>"; } ELSE { $loacation_id0=''; while($row = mysql_fetch_array($MySQLQuery)) { #process new staff member if($row['location_id']<>$location_id0) { $string_content = "blah blah blah
Cheers Matt
You can do something like this:
$getTotalRows = mysql_query($sql); $totalRowsNum = mysql_num_rows($getTotalRows);
if ($totalRowsNum==0) { $string_content = "<TR><TD width='25%' colspan='4'>no records found</TD></TR>"; } else { //grab the records }
Thanks