I think that the fastest method and the cheapest one is using "select
count(*) from table" and using mysql_num_rows(), isn't it ? but there
is no other way of retrieving the count() directly, without passing by
php function ?
Actually, SELECT COUNT only returns one row, the count of the table. Do
Select count(*) AS foo from table
$bar = mysql_fetch_array($result);
Faster and more efficient since MySQL maintains this information in an
indexed sort of way. If you do
Select * from table
$result = mysql_query
That counts the rows actually returned in the result set.
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql