The format of the time field is like this 2012-10-22 17:00:00
I want to read the last 1 hours of new records,$time_limit = 1 * 60 * 60;
Then query:
"SELECT * from Commentswhere TimeStamp > Now ()-$time _limit"
But there's no response, what's the problem?
Reply content:
The format of the time field is like this 2012-10-22 17:00:00
I want to read the last 1 hours of new records,$time_limit = 1 * 60 * 60;
Then query:
"SELECT * from Commentswhere TimeStamp > Now ()-$time _limit"
But there's no response, what's the problem?
You can do this by using the function on the field to get to the post index invalid
A different idea.
$timedate = Date (' y-m-d h:i:s ', Time ()), $hourtime = Date (' y-m-d h:i:s ', Time ()-3600); SELECT * from Comments WHERE TimeStamp between $timedate and $timedate;
Timestamp why not build int, but use datetime type. In fact, upstairs can be one less condition, the current time does not need to make restrictions.