Hi Jay
I just tried your code but I used $foo=mysql_fetch_object($result) and
returned $foo->flyCount. It works the same as your code. (I actually have
738 flies in my pot, it's a crowd, and a lot of proteins !!! ;-) ). What
method is heavier on the MySQL engine ?
<thinking>
count() is said to be the fastest way but since we use mysql_num_rows or
mysql_fetch_object (or any other php method) aren't we doubling the
procedure !?
"select count(*) from table" stores only the count in memory which is
stored in the database (as said in the help file). When we use
mysql_num_rows() it counts the records again or only retrieve the count like
mysql does ? .
"select count(*) as mycount from table" stores the count as table with only
one line with one column which is retrieved with mysql_fetch_xxx().
"select all * from table" stores the hole table in memory. Using
mysql_num_rows() counts the lines in that table in memory.
</thinking>
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 realy
is no other way of retrieving the count() directly, without passing by the
php function ?