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
33480
March 15, 2006 01:02PM
8576
July 13, 2006 05:58AM
Re: Creating a trigger via PHP program
16947
July 13, 2006 06:51AM
7174
June 01, 2007 08:51AM
6952
January 31, 2008 10:47AM
6003
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.