Reputation: 21
So, I'm using a script in php that adds a certain time in the future in a mysql database. What I want to do now is, when that time is reached, I want to update the table, changing a value in the table.
I have no idea how to do this... Crons don't update fast enough for this.
Any help would be appreciated.
Upvotes: 2
Views: 226
Reputation: 3918
MySQL has an event scheduler. Similar to crontab but for MySQL. Event Scheduler
Essentially what you would do is create an event with your PHP script. You would tell that event to execute at a specific time.
CREATE
[DEFINER = { user | CURRENT_USER }]
EVENT
[IF NOT EXISTS]
event_name
ON SCHEDULE schedule
[ON COMPLETION [NOT] PRESERVE]
[ENABLE | DISABLE | DISABLE ON SLAVE]
[COMMENT 'comment']
DO event_body;
schedule:
AT timestamp [+ INTERVAL interval] ...
| EVERY interval
[STARTS timestamp [+ INTERVAL interval] ...]
[ENDS timestamp [+ INTERVAL interval] ...]
interval:
quantity {YEAR | QUARTER | MONTH | DAY | HOUR | MINUTE |
WEEK | SECOND | YEAR_MONTH | DAY_HOUR | DAY_MINUTE |
DAY_SECOND | HOUR_MINUTE | HOUR_SECOND | MINUTE_SECOND}
Upvotes: 3
Reputation: 153
make a script and use some browser extension to refresh page :> nah, just a joke. Sorry, weekend starts now! :) cronjobs should to the trick. I think You have missed something.. or question missing some info.
Upvotes: 0