Is there a way to sort the entries in the database by date. I use curdate(); to enter the date.
| SitePoint Sponsor |
Is there a way to sort the entries in the database by date. I use curdate(); to enter the date.





First off, there's no mention of curdate() on php.net. Is that a custom made function?
and if your storing the date as a date/time field, you can sort them when you pull the record from your database.
and example query would look like this:Where tablename is the table you want to get it from and column_name is the column that you want to sort by. ASC is ascending order, and DESC would sort it by descending order.Code:SELECT * from tablename order by column_name ASC
Though i'd need to know the specifics to make this work.
Like the type of the field, how the date is being stored etc.
Curdate() is a MySQL function to return today's dateOriginally posted by Defender1
First off, there's no mention of curdate() on php.net. Is that a custom made function?
More info here:
http://www.mysql.com/doc/D/a/Date_an...functions.html
Sean![]()
Harry Potter
-- You lived inside my world so softly
-- Protected only by the kindness of your nature
Thx defender. It worked perfectly.
Bookmarks