Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.