Or another way if you don't want a result when it's zero.
$rslt = mysql_query("SELECT count(*) as cnt FROM tbl having cnt > 0");

$result = mysql_query("SELECT * FROM tbl");
$number_of_rows = mysql_num_rows($result);

You don't have to do the count in the SQL, as John said earlier a SELECT
COUNT(*) FROM tbl will always return one row, even if the value of the row
is 0. Of course you could always test for that.

CountingRows Solution #317 :^]



* Texas PHP Developers Conf  Spring 2003            *
* T Bar M Resort & Conference Center                *
* New Braunfels, Texas                              *
* Contact [EMAIL PROTECTED]       *
*                                                   *
* Want to present a paper or workshop? Contact now! *

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to