Will i need two database connection for the following created trigger in MySQL?
- by Parth
Will i need two database connection for the following created trigger in MySQL?
"DELIMITER $$ DROP TRIGGER `update_data` $$ CREATE TRIGGER `update_data` AFTER UPDATE on `jos_menu` FOR EACH ROW BEGIN
IF (NEW.menutype != OLD.menutype) THEN
INSERT INTO jos_menuaudit set menuid=OLD.id, oldvalue = OLD.menutype, newvalue = NEW.menutype, field = 'menutype';
END IF;
IF (NEW.name != OLD.name) THEN
INSERT INTO jos_menuaudit set menuid=OLD.id, oldvalue = OLD.name,
newvalue = NEW.name, field = 'name';
END IF;
IF (NEW.alias != OLD.alias) THEN
INSERT INTO jos_menuaudit set menuid=OLD.id, oldvalue = OLD.alias,
newvalue = NEW.alias, field = 'alias';
END IF;
END$$ DELIMITER ;"
I am using PHP for coding....
EDITED
To Execute the previous trigger, will i need to have two DB connection for it? likewise:
mysql_select_db('pranav_test');
mysql_select_db('information_schema');