You might want to use:
mysql_num_rows <function.mysql-num-rows.html> -- Get number of rows in result
Stuart Felenstein wrote:
I want to send back a message when no matches are
found on my search page. Basically "No matches
found". I assumed that mysql_fetch_assoc would be the
determining factor on whether any rows will come back.
As you can see below I do a if ($row_rsCS == false). Apparently though (while the message is sharp and
centered ;)), it is not to right place, since it sends
the message and exits whether records / matches exist
or not. Any suggestions ?
Thank you Stuart
$query_limit_rsCS = sprintf("%s LIMIT %d, %d", $query_rsCS, $startRow_rsCS, $maxRows_rsCS); //print_r($query_limit_rsCS); $rsCS = mysql_query($query_limit_rsCS, $Pmmodel) or die(mysql_error()); //print_r($rsCS); $row_rsCS = mysql_fetch_assoc($rsCS);
if ($row_rsCS == false) ?> <p align="center"><strong><?php print_r ("No Matches Found"); ?> </strong></p> <?php exit;
//print_r($row_rsCS); if (isset($_GET['totalRows_rsCS'])) { $totalRows_rsCS = $_GET['totalRows_rsCS']; } else { $all_rsCS = mysql_query($query_rsCS); $totalRows_rsCS = mysql_num_rows($all_rsCS); } $totalPages_rsCS = ceil($totalRows_rsCS/$maxRows_rsCS)-1;