Re: Small ORDER problem (mysql) :)

From: Date: Wed, 08 May 2002 20:15:26 +0000
Subject: Re: Small ORDER problem (mysql) :)
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-96656@lists.php.net to get a copy of this message
Argh, I meant natsort(), not nsort. My bad, sorry. :-) http://www.php.net/manual/en/function.natsort.php ----- Original Message ----- From: "Nathan" <etherwolf@sopris.net> To: "Leotta, Natalie (NCI/IMS)" <LeottaN@ims.nci.nih.gov>; "'hwk@barry'" <hw2k@barrysworld.com>; <php-general@lists.php.net> Sent: Wednesday, May 08, 2002 2:09 PM Subject: Re: [PHP] Small ORDER problem (mysql) :) You could pull it into a php array and do an nsort() on it. You can also modify your mysql column to be ZEROFILL, which will pad the numbers with zeros so that they sort right within mysql, which would be faster. ----- Original Message ----- From: "Leotta, Natalie (NCI/IMS)" <LeottaN@ims.nci.nih.gov> To: "'hwk@barry'" <hw2k@barrysworld.com>; <php-general@lists.php.net> Sent: Wednesday, May 08, 2002 2:00 PM Subject: RE: [PHP] Small ORDER problem (mysql) :) I don't know then - I've never run into that problem if they were already numeric. You could try sorting in PHP - it might handle things the way you want them to. You might want to send this to the PHP-DB list if you don't hear from anyone else on this list. -Natalie -----Original Message----- From: hwk@barry [mailto:hw2k@barrysworld.com] Sent: Wednesday, May 08, 2002 3:54 PM To: Leotta, Natalie (NCI/IMS) Subject: Re: [PHP] Small ORDER problem (mysql) :) They are numbers, but that doesn't help, I've only solved it by using 03 06 09 12 and so on, but I dont want to use the 0, it looks ugly :) Håkan >>Can you make them numbers instead of characters in your database? If >>not, then you could probably cast them after you query the db, put >>them in arrays, and then sort. >> >>-Natalie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#96656) next »