Wednesday, 7 August 2013

MySQL trigger syntax error on update query

MySQL trigger syntax error on update query

I'm trying to create a trigger on MySQL using 2 tables. I'm able to do it
in another database but the same code adjusted in another database is
giving me syntax error since hours!
CREATE TRIGGER `free_video_used` AFTER UPDATE ON `user`
FOR EACH ROW
IF new.field = 1 THEN
UPDATE free_video SET free_video.used = 1 WHERE free_video.uid = NEW.uid;
END IF;
As you can easily understand after an update on the table "user", the
other table is modified where the field "uid" is equal. Why isn't it
working?! Thanks!!

No comments:

Post a Comment