Answer the question
In order to leave comments, you need to log in
How to make SQL (MySQL) that add a record if 1 hour has passed since the last one?
Hello, please tell me a PHP command that will check if 1 hour has passed, and if so, add a
MySQL database record
. I had such a command for PostgreSQL, but it doesn’t fit MySQL. It returned false if the gap didn't pass
Answer the question
In order to leave comments, you need to log in
insert into tablename (datetimefield /*other fields*/)
select now(), /*other fields*/
from (select 1) anyonerow
where not exists(
select 1 from tablename where datetimefield >= now() - interval 1 hour
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question