Re: [PHP] Help for code to 'sort list' please

2004-02-04 Thread Don Read
On 02-Feb-2004 EastLothianDirectory wrote: > Was just reading your previous reply and my months are indeed in text > and therein > lies the problem. Look at the MySQL functions FIELD() and/or FIND_IN_SET(). Regards, -- Don Read [EMAIL PROTECTED] -- It's

Re: [PHP] Help for code to 'sort list' please

2004-02-02 Thread EastLothianDirectory
ing. Chris - Original Message From: Jochem Maas Date: Mon 2/2/04 20:47 To: [EMAIL PROTECTED] 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 mon

Re: [PHP] Help for code to 'sort list' please

2004-02-02 Thread Jochem Maas
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',

Re: [PHP] Help for code to 'sort list' please

2004-02-02 Thread EastLothianDirectory
PROTECTED] Subject: Re: [PHP] Help for code to 'sort list' please EastLothianDirectory wrote: > Thank you for reply. I already have 'ORDER BY year desc'. > > But as I mentioned how do I get the months and day in order too on the same list. > > Thank you

Re: [PHP] Help for code to 'sort list' please

2004-02-02 Thread Jochem Maas
EastLothianDirectory wrote: I have the following sql query in my Php code: $sql = "SELECT id, date_day, date_month, date_year, title, content FROM $table_name ORDER BY date_year desc"; ... Although it lists in year order descending (in fact what I asked it to do) I would like to learn to sort t

Re: [PHP] Help for code to 'sort list' please

2004-02-02 Thread Hugh Danaher
Chris, It looks like your data in date_year is not in a format that supports a simple DESC sort. Look into getting the column formatted in -mm-dd order (see the mysql manual for this). Read the data in your column, format it, pump it back into the database, then change the column type to 'dat

Re: [PHP] Help for code to 'sort list' please

2004-02-02 Thread John Nichel
EastLothianDirectory wrote: Thank you for reply. I already have 'ORDER BY year desc'. But as I mentioned how do I get the months and day in order too on the same list. Thank you in advance Read the documentation for ORDER BY in MySQL. You can sort on multiple columns. Basically, you can 'OR

Re: [PHP] Help for code to 'sort list' please

2004-02-02 Thread EastLothianDirectory
rectory Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Help for code to 'sort list' please EastLothianDirectory wrote: > I have the following sql query in my Php code: > > $sql = "SELECT id, date_day, date_month, date_year, title, content FROM $table_name > OR

Re: [PHP] Help for code to 'sort list' please

2004-02-02 Thread John Nichel
EastLothianDirectory wrote: I have the following sql query in my Php code: $sql = "SELECT id, date_day, date_month, date_year, title, content FROM $table_name ORDER BY date_year desc"; The rest of the php code is just a simple db connection with a bullet list and 'while' loop with an 'echo res