alvinchua Posted May 13, 2007 Share Posted May 13, 2007 hi ppl.. i need to use trigger for my project and ... can i knoe where do i need to put this trigger code?? inside <? php currently using MFrontpage to do the stuffs... and i not so sure about the NEW and OLD function in this example ... i need to make trigger like a payment will automatically pay when it comes to a date.. pls advice.. ( below is just an example of trigger) mysql> delimiter // mysql> 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 -> // Quote Link to comment https://forums.phpfreaks.com/topic/51191-where-to-put-the-trigger-code/ Share on other sites More sharing options...
bubblegum.anarchy Posted May 14, 2007 Share Posted May 14, 2007 I do not think MySQL triggers fire on a particular date, only when there are changes applied to the database - create a cronjob or windows task event to apply changes to a database on a particular day. Quote Link to comment https://forums.phpfreaks.com/topic/51191-where-to-put-the-trigger-code/#findComment-252471 Share on other sites More sharing options...
fenway Posted May 14, 2007 Share Posted May 14, 2007 5.1 does have an event scheduler. Quote Link to comment https://forums.phpfreaks.com/topic/51191-where-to-put-the-trigger-code/#findComment-253073 Share on other sites More sharing options...
alvinchua Posted May 14, 2007 Author Share Posted May 14, 2007 btw i am using ... phpMyAdmin - 2.9.0.3 MySQL client version: 5.0.27 Quote Link to comment https://forums.phpfreaks.com/topic/51191-where-to-put-the-trigger-code/#findComment-253109 Share on other sites More sharing options...
fenway Posted May 15, 2007 Share Posted May 15, 2007 Then cron is the only way to go. Quote Link to comment https://forums.phpfreaks.com/topic/51191-where-to-put-the-trigger-code/#findComment-253520 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.