WHERE time > NOW() - INTERVAL 5 MINUTE
Try that.
Вопрос
I'm currently writing a script for voting, and I need to know if the user voted in the last 5 minutes. If yes, next vote is forbidden.
How can I make a request for this?
This was my try:
WHERE time AFTER INTERVAL(CURRENT_TIMESTAMP - 5 MINUTES)
Решение
WHERE time > NOW() - INTERVAL 5 MINUTE
Try that.
Другие советы
SELECT COUNT(id), from_unixtime(`timestamp` / 1000, '%Y-%m-%d %H:%i')
FROM `table`
WHERE `timestamp` >= unix_timestamp(CURRENT_TIMESTAMP - INTERVAL 5 MINUTE) * 1000
Refer link below
This will work.
time < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 5 MINUTE)
Try this:
$time = date('YmdHis', strtotime('-5 minutes', strtotime('now')));
"...WHERE time > '$time'"