View Full Version : Sorting data recieved from a databse

03-02-2007, 07:52 PM

I have several records in a database that hold information about events. Each of these has a date field.

What i want to do is be able to sort the data by the date field when i retrieve it from the database, so i can display it in order on my page ie. most recent at the top.

I have the data being retrieved from the database successfully, and just being displaying in no order, but i dont know how to sort the data.

Any suggestions?

Many Thanks.

03-02-2007, 08:00 PM
SELECT * FROM `table` WHERE 1 ORDER BY `datefield` DESC

03-02-2007, 08:14 PM
I thouht it'd be something like that.

Many thanks for your reply. :thumbsup:

03-02-2007, 08:22 PM
You're very welcome. =D