Need some help with MySQL count query and php display

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yonik
Forum Newbie
Posts: 1
Joined: Mon May 11, 2009 8:31 am

Need some help with MySQL count query and php display

Post by yonik »

Try:

Code: Select all

$query = "SELECT count(*) AS num FROM entries";
$results = @ mysql_query ($query, $connection);
$row = mysql_fetch_assoc($results);
echo $row['num'];
Last edited by Christopher on Mon May 11, 2009 12:06 pm, edited 2 times in total.
Reason: Changed code type from text to php.
Post Reply