How do I order a datetime column in mysql database from latest to oldest using php? Do i simply use "ORDER BY TIME"
Get in the habit of inserting a timestamp via php and then order by that field. The user date('',$timestamp) to format it to your liking after pulling it back out.
Not sure if you're using a mySQL 'official' DATETIME value type, or something the program created, so here's some options: 1) if DATETIME, the values in the field will look something like this: YYYY-MM-DD HH:MM:SS and you CAN sort (as already mentioned). 2) since that's not the case, I'm guessing you have two fields, one for date, one for time - in that case sort this way: ORDER BY datefieldname,timefieldname DESC 3) a third possibility is you have a field that isn't organized well - for example "February 7, 2007" instead of "2008-02-07" - if that's the case, there is no easy way to sort.