I have been messing around now for some hours and Im going mad!
Im pulling some heavy data from mySQL with count and grouping,
after this I have to calculate som values and then sort the outcome.
Therefore Im not able to let mySQL do the accuall sort.
So i stuff it into an array, and I need to sort the array and thats where
the problem occures.
1. I declare an array :
$stats_unsorted = array();
for loop start ...
1. fetch mySQL data
2. calculate values
array_push($stats_unsorted,$sum,$user);
// Eks. array_push($stats_unsorted,10,Ola);
// Eks. array_push($stats_unsorted,-5,Kaare);
// Eks. array_push($stats_unsorted,203,Nils);
// Eks. array_push($stats_unsorted,-20,Lars);
for loop end ...
We now have, e.g. this :
Array
(
[0] => Array
(
[0] => 10
[1] => Ola
)
[1] => Array
(
[0] => -5
[1] => Kaare
)
[2] => Array
(
[0] => 203
[1] => Nils
)
[3] => Array
(
[0] => -20
[1] => Tone
)
)
- - - - - - - - - - - - - - - - - - - -
Then comes the sorting part, I want to sort by this :
$stats_unsorted[x][0]
meaning the numbers, ofcourse I would surely like to know
how to sort by the names aswell, $stats_unsorted[x][1],
but I would think that is easy if I could figure out the
main command to sort this in the first place.
Ive tried several times with array_multisort(); but I cant get this
to work, :(
Help would be appretiated!
$stats_SORTED = ???;
Thanks in advance!
--
Kim Steinhaug
---------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
---------------------------------------------------------------
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php