How to get date and time into one string ($moment) and if it works, can mysql do this:
SELECT * FROM table ORDER BY $m开发者_StackOverflowoment ASC
?
Assuming you have a TIMESTAMP
or a DATETIME
column, then the date() function will give you a suitable value to use in a query:
$moment = date("Y-m-d H:i:s"); //current time
The query you put in your question doesn't seem to use it at all however. Using ORDER BY
on a datetime/timestamp column does work though, so you'll get the result set in chronological order.
精彩评论