What's wrong with my trigger?
I created this trigger:
BEGIN
DECLARE current_id bigint(20); DECLARE mail_address varchar(100); DECLARE user_id bigint(20);
SET current_id = post_id
SET mail_address = (SELECT meta_value FROM wp_postmeta WHERE post_id = current_id AND meta_key = "_from_email")
SET user_id = (SELECT ID FROM wp_users WHERE user_email = mail_address)
IF(exists( SELECT * FROM wp_posts WHERE ID = current_id AND post_type = "inbound" AND post_title IN ("Website feedback","General contact form")) THEN
UPDATE wp_posts SET author = user_id WHERE ID = current_id
END IF;
END;
but I get this error:
MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to user near 'SET mail_address... at line 9'
Do you spot any error in my syntax?
Any help is appreciated
Answer Answered by Ian Gilfillan in this comment.
The previous line does not end with a semi-colon.