Jump to content

Archived

This topic is now archived and is closed to further replies.

slipperyfish

Count?

Recommended Posts

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

So far im trying:

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

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

[code]print $tr;[/code]

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

Help appreciated..

Share this post


Link to post
Share on other sites
Try $count = mysql_result( $query, 0, 0 ).

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.