Hey,
In mysql can you order items by when they were last updated?
like
What would I put order by to get the last updated ones first?Code:$last_updated = mysql_query("SELECT id,name,email,status FROM user WHERE status = 'online' ORDER BY ");
Thanks
Hey,
In mysql can you order items by when they were last updated?
like
What would I put order by to get the last updated ones first?Code:$last_updated = mysql_query("SELECT id,name,email,status FROM user WHERE status = 'online' ORDER BY ");
Thanks
I'm pretty sure that you can't. You need to have a column that states when your entry was last updated and have that field updated every time you update that particular entry.
or something like that will work.Code:$last_updated = mysql_query("SELECT id,name,email,status FROM user WHERE status = 'online' ORDER BY date2 desc");
To choose the lesser of two evils is still to choose evil. My personal site
Lemon (04-11-2010)
Correct. So change how it stores the information. For reasons like this (just that generally it is more flexible) it's very common to use a timestamp instead of any formatted date. From that you can get a formatted date or use the timestamp as-is, such as for ordering.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Lemon (04-11-2010)
Bookmarks