Mysql + PHP record count

I have been doing some searching on this, and my confusion lies with whether I can implement the count feature inside my current query without screwing anything up or if I need to make a new variable.

Here is my current query:


$query="SELECT * FROM registrant";
$result=mysql_query($query);

$num_rows = mysql_num_rows($result);

I just want to show the # of records in the table AND then have a separate query that shows how many records DON’T have a value of ‘Yes’ for the field “accept”.

So it might end up saying something like

TOTAL RECORDS: 200

WITHOUT ACCEPTANCE: 20

Any help?

Thanks,
Bryan

You could loop through the results and count as you go… but if you just need the numbers, it would probably better to let SQL do the count for you (using 2 queries, each with a different WHERE)

ok, I got it to work:

I simply echoed the appropriate num_rows and num_rows_no


$query="SELECT * FROM registrant";
$result=mysql_query($query);

$num_rows = mysql_num_rows($result);

$query2="SELECT * FROM registrant WHERE accept is null";
$result2=mysql_query($query2);
$num_rows_no = mysql_num_rows($result2);