Re: Creating a trigger via PHP program
Posted by:
Murz
Date: July 13, 2006 06:51AM
Do it like this with mysqli php extension:
<?php
$db=new mysqli($host, $user, $password, $db);
$trigger="CREATE TRIGGER trigger1 BEFORE INSERT ON table1
FOR EACH ROW
BEGIN
IF NEW.VALUE1 = 1 THEN
SET NEW.VALUE2 = 'one';
ELSEIF NEW.VALUE1 = 2 THEN
SET NEW.VALUE2 = 'two';
END IF;
END;
";
$db->multi_query($trigger);
?>
Subject
Views
Written By
Posted
33478
March 15, 2006 01:02PM
8574
July 13, 2006 05:58AM
Re: Creating a trigger via PHP program
16945
July 13, 2006 06:51AM
7173
June 01, 2007 08:51AM
6949
January 31, 2008 10:47AM
6002
April 02, 2008 08:53AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.