Forum Moderators: coopster
// Im using this code to group and sum:
$query = "SELECT firstname, SUM(points) FROM people GROUP BY firstname";
$result = mysql_query($query) or die(mysql_error());
$newarray = array();
// Print out result
while($row = mysql_fetch_array($result)){
$newarray[] = $row['firstname'].$row['SUM(points)'];
}
What I get is something like:
jim 14
ric 12
jon 21
when what I really want is a sorted list:
jon 21
jim 14
ric 12
but doing a sort doesnt work? Any ideas how else I can tackle the issue?
Im glad to see this is a thriving forum!
cheers.bo