Will i need two database connection for the following created trigger in MySQL?

Posted by Parth on Stack Overflow See other posts from Stack Overflow or by Parth
Published on 2010-03-30T10:42:50Z Indexed on 2010/03/30 10:53 UTC
Read the original article Hit count: 352

Filed under:
|
|

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');

© Stack Overflow or respective owner

Related posts about mysql

Related posts about triggers