Skip to content
Advertisement

Unable to create this MYSQL Trigger on PHPMYADMIN

I am trying to update a column ( called DateModified ) before update happens on the table row.

so here is my trigger:

CREATE TRIGGER `date_mod_category` BEFORE UPDATE ON `categories`
 FOR EACH ROW BEGIN
    SET new.DateModified = NOW();
END

BUT I GET THIS DAMN ERROR WHICH I JUST CANNOT FIGURE OUT WHY:

enter image description here

Advertisement

Answer

Use DELIMITER

DELIMITER //
CREATE TRIGGER `date_mod_category` BEFORE UPDATE ON `categories`
 FOR EACH ROW 
 BEGIN
   SET new.DateModified = NOW();
 END //
 DELIMITER ;
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement