i am using the following to count the records within groups, is there an easier way using COUNT ?? therefore enabling me to order the results
$result=mysql_query("SELECT word, FROM key GROUP by word ORDER by word ASC");
$list = mysql_num_rows($result);
while ($i < $list) {
$row = mysql_fetch_array($result);
$key = $row["word"];
$resulta= mysql_query ("SELECT * FROM key WHERE word='$key'");
$count = mysql_num_rows($resulta);
print"$key";
print"$count";
$i++;
}
The above will print the following :-
apple 1
bannana 5
orange 2
strawberry 7
I would like them to be ordered by highest number.
Any ideas to make it easier than having two calls to the db ??
Darren Ramowski