Thanks Tom, I had a complicated sql line and used my count(var) for the order by statement and bingo. Just sometimes you forget the obvious an need a kick up the **** :-)
Dave C -----Original Message----- From: Tom Rogers [mailto:[EMAIL PROTECTED] Sent: 02 January 2004 15:22 To: Dave Carrera Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Sort a while loop ? Hi, Saturday, January 3, 2004, 1:12:49 AM, you wrote: DC> Hi List, DC> How can I sort a while loop or do something before it to achieve the DC> following? DC> I have a MySql result fetching something like this: DC> Id Name Number DC> 1 Bob 34567 DC> 2 Ben 234 DC> 3 Jeff 4567 DC> 4 Dave 2345 DC> But I want to sort the while loop by Number Highest first so the DC> result looks like this: DC> Id Name Number DC> 1 Bob 34567 DC> 2 Jeff 4567 DC> 3 Dave 2345 DC> 4 Ben 234 DC> I have looked at sort() asort() and others in the manual and either DC> I am doing something wrong (which is more than likely) or a while DC> loop is not what I need to use to achieve this. DC> Thank you in advance for any help DC> Dave C DC> P.S: Happy New Year to you all. DC> --- DC> Outgoing mail is certified Virus Free. DC> Checked by AVG anti-virus system (http://www.grisoft.com). DC> Version: 6.0.556 / Virus Database: 348 - Release Date: 26/12/2003 add ORDER BY number DESC to your mysql query -- regards, Tom --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.556 / Virus Database: 348 - Release Date: 26/12/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.556 / Virus Database: 348 - Release Date: 26/12/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php