Greaser9780 Posted March 3, 2007 Share Posted March 3, 2007 Is it possible to have mysql do something everytime it updates a certain table? I have a function I would like to run evertime a table is updated. Quote Link to comment Share on other sites More sharing options...
fenway Posted March 3, 2007 Share Posted March 3, 2007 PHP function? Not really... with triggers, you can get MySQL to do some fancy stuff, though. Quote Link to comment Share on other sites More sharing options...
Greaser9780 Posted March 3, 2007 Author Share Posted March 3, 2007 Would it be possible to have it run a check to see if it needs to update every time a certain row is updated? Quote Link to comment Share on other sites More sharing options...
fenway Posted March 4, 2007 Share Posted March 4, 2007 Have what check? Quote Link to comment Share on other sites More sharing options...
Greaser9780 Posted March 13, 2007 Author Share Posted March 13, 2007 I have a timer and another program I currently run as CRON jobs. I would like to utilize a trigger instead though. One script is a check to see if a timer has run out. The other checks to see if a user made a predetermined choice before it is his/her turn to enter their choice. The latter checks if a pre-choice has been made and when it is the users turn updates the db with their info. Since the program I made will be duplicated many times I was wondering if all the CRON jobs would put a large load on the server. In order for the program to seem efficient each CRON would have to run almost every minute or 2. I figure if I can get a trigger to do it then it would only run when the db is updated. A signifigant server load reduction and better timing for the site. Quote Link to comment Share on other sites More sharing options...
fenway Posted March 13, 2007 Share Posted March 13, 2007 I'm confused about what you're trying to do... Quote Link to comment Share on other sites More sharing options...
Greaser9780 Posted March 14, 2007 Author Share Posted March 14, 2007 I'd like to set up a way to run a php file everytime the db is updated. I would prolly have to use a require after every single UPDATE query to the db though. Would rather do a trigger but wasn't sure if you could have a trigger run a php file. Quote Link to comment Share on other sites More sharing options...
fenway Posted March 14, 2007 Share Posted March 14, 2007 You can't have a DB trigger do anything outside the DB... a cron job is better suited for this. Quote Link to comment Share on other sites More sharing options...
Greaser9780 Posted March 14, 2007 Author Share Posted March 14, 2007 What is a good rule of thumb for timing of CRON jobs?I currently run 4 on a site 2 everyten minutes and 2 every minute. Quote Link to comment Share on other sites More sharing options...
fenway Posted March 14, 2007 Share Posted March 14, 2007 Depends how much work they're doing... I have cron jobs running every minute, but 99% of the time, they do nothing. Quote Link to comment Share on other sites More sharing options...
Greaser9780 Posted March 14, 2007 Author Share Posted March 14, 2007 They basically check to see if a program is started.If it is it runs through a series of variables and usually ends up running 1-3 simple queries. Quote Link to comment Share on other sites More sharing options...
fenway Posted March 14, 2007 Share Posted March 14, 2007 Then you shouldn't have any issues. Quote Link to comment 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.