I'm using a query to output a list of members of a shoutbox and their shout count:
SELECT user_id, COUNT( * ) AS Shouts
FROM shouts
GROUP BY user_id
ORDER BY Shouts DESC
Which displays:
User1: 3490
User2: 1234
User3: 345
...
I've tried the following:
$result = mysql_query(the query above);
$count = mysql_fetch_array($result);
echo $count['Shouts'];
but it only displays the first row. How can I display the whole result?
You need to put the mysql_fetch_array within a loop:
while ($count = mysql_fetch_array($result)) {
echo $count['Shouts'];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.