I am very new to Triggers and so this is a very beginner question. I am trying simply to, before a row updates, store its id, old and new values, and the current date into a new table. I have tried the following:
DELIMITER //
DROP TRIGGER IF EXISTS stockTrig//
CREATE TRIGGER stockTrig BEFORE UPDATE ON products
FOR EACH ROW
BEGIN
IF NEW.quantity != OLD.quantity THEN
INSERT INTO stock_log SET p_id = OLD.id, old_stock = OLD.quantity, new_stock = NEW.quantity, date = CURDATE();
END IF;
END//
DELIMITER;
I'm getting the following:
1235 - This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'
...which I don't quite understand. I am using MySQL 5.1.53, which shouldn't be outdated. What exactly is going wrong here?