Re: sorting array question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi guys,

thanks for the replies! yes Melanie, you were correct the last example (i had an old version of the manual). seemed to do the trick =)

Thanks to john as well for the reply.

Angelo

Melanie Maddix wrote:

[snip]
So they way I want to sort these rows is by total, totalPaid, totalUnpaid all descending.
Output should be:
partnerID  | partnerName | total  | totalPaid  | totalUnpaid
5                  berty               30    12                18
7 sarah 19 12 7 1 marc 12 5 7



I have looked at the manual and found uasort and array_multisort, but these don't seem to be appropriate unless Im missing something but the examples found are very vague.
If anyone can help that would be great,

Thanks in advance
Angelo
[/snip]


Hi Angelo,

Take a look at Example 3 under array_multisort, the one that sorts by
volume and edition.
You first build arrays of the columns you want to sort by, then pass
them as an argument to array_multisort, along with your original array.

Melanie


--
------------------------------------------------------------------------
Angelo Zanetti
Systems developer
------------------------------------------------------------------------

*Telephone:* +27 (021) 469 1052
*Mobile:*       +27 (0) 72 441 3355
*Fax:*            +27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* angelo@xxxxxxxxxxxx <mailto:jerry@xxxxxxxxxxxx>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux