Welcome Guest, Not a member yet? Register   Sign In
how to access the count(*) property?
#13

[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().


Messages In This Thread
how to access the count(*) property? - by El Forum - 01-21-2010, 11:45 PM
how to access the count(*) property? - by El Forum - 01-22-2010, 12:25 AM
how to access the count(*) property? - by El Forum - 01-22-2010, 12:53 AM
how to access the count(*) property? - by El Forum - 01-22-2010, 12:56 AM
how to access the count(*) property? - by El Forum - 01-22-2010, 12:58 AM
how to access the count(*) property? - by El Forum - 01-22-2010, 03:33 AM
how to access the count(*) property? - by El Forum - 01-22-2010, 04:02 AM
how to access the count(*) property? - by El Forum - 01-22-2010, 07:09 AM
how to access the count(*) property? - by El Forum - 01-28-2010, 08:40 PM
how to access the count(*) property? - by El Forum - 01-28-2010, 09:11 PM
how to access the count(*) property? - by El Forum - 01-28-2010, 09:58 PM
how to access the count(*) property? - by El Forum - 01-29-2010, 12:31 AM
how to access the count(*) property? - by El Forum - 01-29-2010, 03:35 AM
how to access the count(*) property? - by El Forum - 01-29-2010, 04:18 AM
how to access the count(*) property? - by El Forum - 02-07-2010, 06:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB