10-20-2008, 07:35 PM
|
#2 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
The sql doesnt seem to be the problem, although you may want to change it to DESC in order to get the most frequent first.
There are some errors in you script, you have not passed mysql_fetch_array a valid result link.
PHP Code:
$q = mysql_query("SELECT COUNT(`id`) AS freq, `name` FROM `table` GROUP BY `name` ORDER BY freq DESC"); echo '<ul>'; while($fetch = mysql_fetch_array($q)) { echo '<li>'.$fetch["name"].'</li>'; } echo '</ul>';
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|