Re: Sort a while loop ?

From: Date: Fri, 02 Jan 2004 15:22:04 +0000
Subject: Re: Sort a while loop ?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-173634@lists.php.net to get a copy of this message
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 result DC> 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 I am DC> doing something wrong (which is more than likely) or a while loop is not DC> 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

« previous php.general (#173634) next »