Results 1 to 1 of 1
Feb 18, 2012, 11:27 #1
- Join Date
- Feb 2012
- 0 Post(s)
- 0 Thread(s)
EVENT in MYSQL does not run, but seems fine??
I am struggling to set up an EVENT in mysql - But it doesnt execute the commands, and I have spend hours to figure out why by now.
I hope to find the answer here :-)
This is the code for the event:
delimiter | CREATE EVENT delete_cart ON SCHEDULE EVERY 5 MINUTE DO BEGIN DECLARE cartID INTEGER( 11 ) ; DECLARE cartProductID INTEGER( 11 ) ; DECLARE cartAntal INTEGER( 11 ) ; DECLARE cartStr VARCHAR( 5 ) ; SELECT id, produkt_id, antal, str INTO cartID, cartProductID, cartAntal, cartStr FROM cart WHERE added_date >= added_date +10000 LIMIT 1; UPDATE products SET stock = stock + cartAntal WHERE produkt_id = cartProductID; UPDATE sizes SET antal = antal + cartAntal WHERE size = cartStr AND product_id = cartProductID; DELETE FROM cart WHERE id = cartID; END | delimiter ;
It is pretty straight forward what should happen here. The EVENT is set up and running, but nothing happens.
The event_scheduler is set to ON.
I just cant see why?
Has the variables been declared with a wrong syntax?
Hope to get an answer on this soon, thanks!