View Single Post
Old 10-20-2008, 06:51 PM   #1 (permalink)
paulOr
The Wanderer
 
paulOr's Avatar
 
Join Date: Nov 2007
Location: Edinburgh
Posts: 21
Thanks: 1
paulOr is on a distinguished road
Default Fetching top amount of keywords


Im looking for a way to show the results of this database like this:

Top Keywords
  1. Code
  2. MySQL
  3. poop
  4. ass

Because, if you look at screenshot, Code has 3 entries ( so #1 ) MySQL has two entries ( #2 ) and then the rest under it :)

I have this so far, but it doesnt work :(
Code:
	$q = mysql_query("SELECT COUNT(`id`) AS freq, `name` FROM `table` GROUP BY `name` ORDER BY freq ASC");
	
	echo '<ul>';
	while($fetch = mysql_fetch_array) {
		echo '<li>'.$fetch["name"].'</li>';
	}
	echo '</ul>';
Thanks in advance.
__________________
paulOr.net
paulOr is offline  
Reply With Quote