Jump to content

Mysql Events


vonduck

Recommended Posts

Hello,

 

Im having problems using the mysql event function. The query im using is the following:

CREATE EVENT newEvent
ON SCHEDULE EVERY 1 DAY
DO
UPDATE orderrader SET vs=1 WHERE order_datum <= DATE_SUB(NOW(), INTERVAL 14 DAY) ; 

The event is supposed to update the vs-field to one 14 days after the row is written into the database.

I checked the table out 15 days after the first row was inserted, but still no update.

 

Thanks alot,

 

Erik

Link to comment
https://forums.phpfreaks.com/topic/276907-mysql-events/
Share on other sites

Try,

CREATE EVENT newEvent
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
DO
UPDATE orderrader SET vs=1 WHERE order_datum <= DATE_SUB(NOW(), INTERVAL 14 DAY) ; 

I've tested that one, it worked to me.

CREATE EVENT newEvent
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 minute
DO
UPDATE orderrader SET vs=1 WHERE order_datum <= DATE_SUB(NOW(), INTERVAL 14 DAY) ;

I don't know why that one does not work to me.

CREATE EVENT newEvent
ON SCHEDULE EVERY 1 minute
DO
UPDATE orderrader SET vs=1 WHERE order_datum <= DATE_SUB(NOW(), INTERVAL 14 DAY) ;
Link to comment
https://forums.phpfreaks.com/topic/276907-mysql-events/#findComment-1424857
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.