Search code examples
mysqltriggersphpmyadmininnodbmariadb

Why error occurs when creating the trigger?


I am trying to add a trigger through phpmyadmin 4.4

enter image description here

I get the error:

enter image description here

Why is this happening? How to declare a variable?


Solution

  • Start with BEGIN, end with END. Put the various statements between them.

    Notice in the error how it is alread providing FOR EACH ..., but it is depending on you to do the rest. See http://dev.mysql.com/doc/refman/5.7/en/triggers.html (and other pages) for the complete syntax that phpmyadmin is "helping" you generate.