I need to create an event that will contain 2 (or more) update queries. Here is what I tried
$query1 = "CREATE EVENT IF NOT EXISTS 'event name'
ON SCHEDULE EVERY 1 DAY ON COMPLETION PRESERVE ENABLE
DO
UPDATE 'table1' SET 'myset'='1' WHERE 'something' ='1'
UPDATE 'table2' SET 'active'='off' WHERE 'somethingelse'='1';";
I can do it by creating 2 events and place each update with one event but they will be to many events.
Edit: The problem is that this code will create an event that will contain only the first UPDATE inside, the second UPDATE is lost.
I think you need to put a ;
after first UPDATE too. Like:
$query1 = "CREATE EVENT IF NOT EXISTS 'event name'
ON SCHEDULE EVERY 1 DAY ON COMPLETION PRESERVE ENABLE
DO
UPDATE 'table1' SET 'myset'='1' WHERE 'something' ='1';
UPDATE 'table2' SET 'active'='off' WHERE 'somethingelse'='1';
";