I created an event with a set of sql statements in mysql terminal, It is working fine. But I want to create this event from php script. My query is below.
DELIMITER |
CREATE EVENT e_cart
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 3 MINUTE
DO
BEGIN
SET @var_orderid = '';
SET @var_orderid = (SELECT orderid FROM order WHERE id=308);
IF @var_orderid = NULL THEN
UPDATE order SET status=1 WHERE id=308;
END IF;
END |
DELIMITER ;
This results in :-
Error : 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 'DELIMITER | CREATE EVENT e_cart ON SCHEDULE AT CUR' at line 1
How do I execute this event from php script?