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 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; 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 Are you able to see it in your database? SHOW EVENTS; Yes it looks like supposed, i guess, see below: 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) ; Link to comment https://forums.phpfreaks.com/topic/276907-mysql-events/#findComment-1424857 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.