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:
ON SCHEDULE EVERY 5 MINUTES
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;
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
1 Year Ago
Related Article:query error ? SQL syntax ?
is a solved MySQL discussion thread by qwertpink that has 5 replies, was last updated 1 year ago and has been tagged with the keywords: error, query, sql, syntax.