[eluser]Phil Sturgeon[/eluser]
[quote author="jmadsen" date="1264754428"]Uh, Phil...
the number of rows returned is not the same as count(*)
"SELECT count(*) `count` FROM table WHERE ..."
->num_rows() is 1
$row->count is how ever many rows meet the where clause...
Maybe you want to read the post? ;-)[/quote]
I was giving general counting examples to show corrected syntax as most of the posts so far were a little off.
And of course if you run num_rows() on a COUNT() query you will only get 1, why would you get any more? The only value returned is an integer counting how many results matched the WHERE criteria, which is exactly what num_rows() would do.
If you are only wanting to return a count, then COUNT() will be the same as num_rows(). If you need data back to then you need to use num_rows().