Don't bother with doing it in PHP, do it in MySQL with a functional
ordering:

Select Make from your_db order by if(left(Make,7)='no make','zzzzzzzz',Make)

-----Original Message-----
From: Tom Beidler [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 19, 2001 11:53 AM
To: php list
Subject: [PHP] how to move one element of an array to the end of the
array


I'm running a query that pulls up automotive makes for a given year and
orders them alphabetically. One of the options is "no make specified" which
I would like to always move to the end of the mysql_fetch_array. So my while
loop would pull up

AMC
Ford
Volkswagon
No make specified

Instead of

AMC
Ford
No make specified
Volkswagon

After looking over the php site it doesn't look like there is an easy way to
do it.  Should I take the array, remove the element and then add it to the
end?

The no make specified unique id in the make database is 1. I could order by
id, use array_shift to pop off the first element, sort the array by asort,
and then add it on the end using array_push.

Is there a better way?

Thanks,
Tom

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to