Jump to content


Photo

Count?


  • Please log in to reply
1 reply to this topic

#1 slipperyfish

slipperyfish
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 26 March 2006 - 05:11 PM

How can I put the result from a count() query into a variable?

So far im trying:

$totalSQL = "SELECT COUNT(*) FROM feedback";
    $tq = mysql_query($totalSQL);
    $tr = mysql_fetch_array($tq);

and trying to use "$tr" as the variable.. like:

print $tr;

but not having much look.. i know there is 12 rows.. however not printing anything.

Help appreciated..

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 26 March 2006 - 08:41 PM

Try $count = mysql_result( $query, 0, 0 ).
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users