Since you mention mysql, why not just add

"ORDER BY number DESC" to your query? The database will do the work for you.



"Dave Carrera" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi List,
>
> How can I sort a while loop or do something before it to achieve the
> following?
>
> I have a MySql result fetching something like this:
>
> Id Name Number
> 1  Bob  34567
> 2  Ben  234
> 3  Jeff 4567
> 4  Dave 2345
>
> But I want to sort the while loop by Number Highest first so the result
> looks like this:
>
> Id Name Number
> 1  Bob  34567
> 2  Jeff 4567
> 3  Dave 2345
> 4  Ben  234
>
> I have looked at sort() asort() and others in the manual and either I am
> doing something wrong (which is more than likely) or a while loop is not
> what I need to use to achieve this.
>
> Thank you in advance for any help
>
> Dave C
>
> P.S: Happy New Year to you all.
>
> ---
> 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

Reply via email to