Jump to content

how to use trigger??


alvinchua

Recommended Posts

hi ppl... i am totally new to this stuff and i need to create a trigger before an update operation is occured and i got a sample of trigger from the internet... where should i put this trigger inside <?php ???

 

CREATE TRIGGER updtrigger BEFORE UPDATE ON tenaga
FOR EACH ROW
BEGIN
IF NEW.EffectiveDate = date THEN
SET NEW.Salary=10000;
ELSEIF NEW.Salary>500 THEN
SET NEW.Salary=15000;
END IF;
END
";

 

i need a trigger to update the database when it comes to a particular date... and this is the code for the update...

 

	
$Total = $valueself- $amount;
$Total2 = $payvalue- $amount;
echo $Total;
//echo $Total2;

$payee  = $_POST['select'];

$queryinsert = "UPDATE personal SET AccountBalance = ('$Total')". "WHERE CusName = 'user1'";
$queryinsertT = "UPDATE tenaga SET OverdueAmount = ('$Total2')". "WHERE CusName = 'user1'";
$queryDate = "UPDATE tenaga SET EffectiveDate= ('$payee')". "WHERE CusName = 'user1'";

 

how can i do that?? pls advice.. thanks ~

Link to comment
https://forums.phpfreaks.com/topic/51270-how-to-use-trigger/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.