Reputation: 2596
I want to make a trigger to a certain table that makes it so that when I insert data into that table, two other tables are updated. I am trying to do something like this, on the trigger section of phpMyAdmin:
INSERT INTO db.tableOne (id, name, country) VALUES (NEW.id, NEW.name, NEW.country);
INSERT INTO db.tableTwo (id, colour, price) VALUES (NEW.id, NEW.colour, NEW.price);
It gives me a syntax error.
I tried creating 2 different triggers for the same action on that table but it says that I can't have 2 triggers for the same action. Any help is deeply appreciated!
Upvotes: 1
Views: 1421
Reputation: 2596
Ok, solved. For anyone who has the same problem, it's quite easy actually: just put a "BEGIN" statement before the "INSERT" statements, and a "END" statement after.
Upvotes: 3