Book Image

Building a Web Application with PHP and MariaDB: A Reference Guide

By : Sai S Sriparasa
Book Image

Building a Web Application with PHP and MariaDB: A Reference Guide

By: Sai S Sriparasa

Overview of this book

Table of Contents (17 chapters)
Building a Web Application with PHP and MariaDB: A Reference Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Working with stored procedures


Using a stored procedure, we can wrap multiple SQL statements into a single unit that provides the integrity and consistency in which the SQL statements are executed. Assume that there are multiple developers performing the same set of tasks again and again, executing the same set of statements one at a time, in the same or a different order based on the developer's preferences. The process can be consolidated by putting these statements into a stored procedure. This single unit can be thoroughly tested for maintaining data integrity and executing consistency across different scenarios. Another reason why the stored procedures are preferred over a set of multiple SQL statements is the performance boost that the stored procedures provide. To build a stored procedure, we would need two things at a minimum, the first being the name of the stored procedure and the second being the body or the content inside the stored procedure. Let's write a simple stored procedure...