> $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 :^]

That's a really ineffecient solution, though. COUNT() of optimized to return
a quick result. Why would you select everything and use up all of those
resources to just get a count of the rows?

---John Holmes...


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

Reply via email to