Triggers

Triggers allow you to add functionality to your tables so that they perform a certain series of actions whenever a defined query is made. For example, it is possible to have your DBMS recalculate certain values whenever new records are added, or whenever more than ten rows have been read at once.

Many people find triggers problematic because they are hard to debug, and often cause unexpected actions. However, if used properly they fulfil a role that nothing else can, and so can help a great deal.

 

Want to learn PHP 7?

Hacking with PHP has been fully updated for PHP 7, and is now available as a downloadable PDF. Get over 1200 pages of hands-on PHP learning today!

If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!

Next chapter: Views >>

Previous chapter: Stored procedures

Jump to:

 

Home: Table of Contents

Copyright ©2015 Paul Hudson. Follow me: @twostraws.