News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPMaster.com:
Action Automation with MySQL Triggers
December 11, 2012 @ 09:16:29

For the MySQL users out there, PHPMaster.com has a new tutorial showing you how to use triggers in your database to perform automatic actions on things like "before update" or "after insert".

By making MySQL do more work through triggers, the PHP side of my project was greatly simplified. So, it is the intention of this article to give you some insight into the creation and usage of MySQL triggers, so that by the end of this reading you can make use of them in your own projects.

They start by explaining what triggers are and how they're created on the database side (with an example syntax). They apply one to a more practical situation - helping keep data integrity on a revenue table based on the data inserted into an events tracking table. Their trigger ("CostCalc") calculates the time of the event on update and updates the revenue table with the correct cost. Also included is the sample PHP code (an "EventHandler") that updates the event records. The trigger fires transparently in the background with no need for the PHP script to make any additional calls.

0 comments voice your opinion now!
mysql trigger automation tutorial update


blog comments powered by Disqus

Similar Posts

IBM developerWorks: Cook up Web sites fast w/CakePHP, Part 1: Adding related information & services

Joshua Thijssen's Blog: Password hashing and salting

Odafe Ojenikoh's Blog: Interactive PHP CLI Applications using Zend Form

Joshua Eichorn's Blog: PEAR2 Unconference

Gonzalo Ayuso: Sending Android Push Notifications from PHP to phonegap applications


Community Events





Don't see your event here?
Let us know!


introduction deployment community code zendserver laravel podcast framework voicesoftheelephpant development bugfix language conference list api interview symfony series tips release

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework