Re: Help for code to 'sort list' please
| From: | EastLothianDirectory | Date: | Mon, 02 Feb 2004 19:39:13 +0000 |
| Subject: | Re: Help for code to 'sort list' please | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-176602@lists.php.net to get a copy of this message | ||
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
---- Original Message ----
From: John Nichel
Date: Mon 2/2/04 19:31
To: EastLothianDirectory
Cc: php-general@lists.php.net
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
> 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 result' request.
>
> This shows a list of dates with latest year on top of list.
> I have Select/Option boxes to chose day,month,year etc to fill in Php form
> to update database.
>
> This is result of sql query:
>
> 2-August-2007
> 1-January-2007
> 30-December-2007
> 8-July-2006
> 29-February-2006
> 3-March-2006
> 16-February-2005
> 1-January-2004
>
> Although it lists in year order descending (in fact what I asked it to do)
> I would like to learn to sort the months and days into desc order properly too.
>
> Can anyone suggest how I achieve this with php code.
>
> Thank you in advance
>
Let the db do this. ORDER BY
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php