vonduck Posted April 13, 2013 Share Posted April 13, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/276907-mysql-events/ Share on other sites More sharing options...
jazzman1 Posted April 13, 2013 Share Posted April 13, 2013 Are you able to see it in your database? SHOW EVENTS; Quote Link to comment https://forums.phpfreaks.com/topic/276907-mysql-events/#findComment-1424593 Share on other sites More sharing options...
vonduck Posted April 15, 2013 Author Share Posted April 15, 2013 (edited) Are you able to see it in your database? SHOW EVENTS; Yes it looks like supposed, i guess, see below: Edited April 15, 2013 by vonduck Quote Link to comment https://forums.phpfreaks.com/topic/276907-mysql-events/#findComment-1424802 Share on other sites More sharing options...
jazzman1 Posted April 15, 2013 Share Posted April 15, 2013 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) ; Quote Link to comment https://forums.phpfreaks.com/topic/276907-mysql-events/#findComment-1424857 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.