Hey,
I am trying to create this EVENT via phpmyadmin, but I get a syntax error which I cant see:
This is the code for the event:
DELIMITER |
CREATE
EVENT delete_cart
ON SCHEDULE EVERY 5 MINUTES
DO
BEGIN
DECLARE cartID INTEGER;
DECLARE cartProductID INTEGER;
DECLARE cartAntal INTEGER;
DECLARE cartStr VARCHAR;
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;
The error message returned is as follows:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MINUTES DO BEGIN DECLARE cartID INTEGER; DECLARE cartProductID INTEGER; ' at line 3