php - MySql Insert Query based on Timestamp (delayed insert)
i need to dodelayed
mysql insert
into my database based on the time choosen.
Example:Timestamp
choosen ="2013-04-03 10:12:00"
so i want myinsert query
to get executed at this("2013-04-03 10:12:00")
particular time.
$qry = mysql_query("INSERT INTO table (field) value ($value)");
i am having amysql innoDB
database.
and i will be accepting thistimestamp
value from user from aHTML+PHP
interface.
and yes, idont want
to docron jobs
Answer
Solution:
No option without cron job...
You need a
cron job
setup forevery minute
, in which the query is looking for any matching timestamp for the insert query.But for every minute
cron job
is not better for DB health if you have more and more data to insert, you should think again about the time interval for better performance.Answer
Solution:
You could insert data into additional table, then use MySQL events to copy records into target table at exact time. For example -
Using the Event Scheduler.