Re: Help for code to 'sort list' please
| From: | EastLothianDirectory | Date: | Mon, 02 Feb 2004 21:03:51 +0000 |
| Subject: | Re: Help for code to 'sort list' please | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-176621@lists.php.net to get a copy of this message | ||
Was just reading your previous reply and my months are indeed in text and therein
lies the problem.
I will have to completely rewrite the online form which will add a(mysql type)
date to add it and all the fields to the DB.
I will research the 'PHPs array sorting functions' that you mention. It might be
quicker.
......Just thought that it WILL be quicker converting the months in the
SELECT/OPTION boxes to integers then no need to do a complete rewrite although I
should learn how to do the mysql date thing anyway.
Thanks Jochem and also to Hugh for replying.
Chris
-----------------
---- Original Message ----
From: Jochem Maas
Date: Mon 2/2/04 20:47
To: php-general@lists.php.net
Subject: Re: [PHP] Help for code to 'sort list' please
refering to my previous mail: I really don't think its a good idea to
store the months as names in the DB (I recommend a datetime field to
store the complete date info).
but if you must then you will have to define an array which you can use
as a sort key e.g.
array(
1 => 'January',
2 => 'February',
...etc...
);
and use something like this is combination with a multisort array
function to get the order you want - but the way I see it your better
off changing the DB schema and using a few date related function is
either MySQL or PHP to display the dates in a user friendly way (e.g.
'10 January 2004').
EastLothianDirectory wrote:
> Thank you for replying again but I have already been on the Mysql.com website
> and although I did ascertain the correct syntax ie
>
...
>
> None of them work mainly because the months get listed alphabetically and not IN
> ORDER. For example AUGUST is listed as the first month because it started with 'A'
> The year and day being integers were listed correctly.
>
> Now do you see the problem. This is why Mysql.com was no good so I came to PHP
for
> help.
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php