Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.