Zecrow
Zecrow

Reputation: 233

Trigger error on update

CREATE TRIGGER `update_hidden` AFTER UPDATE ON boutique
    FOR EACH ROW
    BEGIN
         UPDATE `items` SET hidden = NEW.hidden WHERE boutique_id = NEW.id;
    END

I have a table boutique and table items, both have field hidden, after executing this code i get a syntax error, what is my mistake?

Upvotes: 1

Views: 56

Answers (1)

Saharsh Shah
Saharsh Shah

Reputation: 29051

Remove spaces between ROW BEGIN:

CREATE TRIGGER `update_hidden` AFTER UPDATE ON boutique
    FOR EACH ROW BEGIN
         UPDATE `items` SET hidden = NEW.hidden WHERE boutique_id = NEW.id;
    END

Upvotes: 1

Related Questions