This is not really a problem but I want to know if it can be done.
On my football pool site, I already have set up a php sort set up to order the members' from most wins to least wins.
The array is:
$player_id();
[username] => [# of wins]
So the username is the key and # of wins is a numeric value. This works fine.
Is there a way to sort first from the [# of wins] then sort the [username]
eg.
Zack - 10 wins
Amber - 10 wins
Bob - 10 wins
The way it sits now, if would group all the same wins together but the sort is from whoever entered their data first.
I'd like it to be:
Amber
Bob
Zack
This is not a big deal, just wondering if there is a way.
I've already tried ksort
This is a small sniplet of the sorting and retreiving data.
Code: Select all
arsort( $player_id );
foreach( $player_id as $key => $value ){
$result = mysql_query("SELECT id, wiguser FROM members WHERE wiguser='$key'");
$pics_name = mysql_fetch_array($result);