News Feed
Sections




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

SitePoint PHP Blog:
Stored Procedures in MySQL and PHP
January 06, 2014 @ 10:39:55

The SitePoint PHP blog has a new post today from Taylor Ren looking at the use of stored procedures in MySQL via PHP. He goes through some of the basics - advantages and disadvantages - but also provides some simple examples.

Put simply, a Stored Procedure ("SP") is a procedure (written in SQL and other control statements) stored in a database which can be called by the database engine and connected programming languages. In this tutorial, we will see how to create an SP in MySQL and execute it in MySQL server and in PHP. [...] SP are also available in other common database servers (Postgre for example) so what we will discuss here can be applied to those as well.

He starts off with some reasons why using stored procedures is recommended (in certain cases) and what they can do to help your application. He also lists a few drawbacks to their use, including that they're hard to version/backup. He shows you how to create a simple stored procedure for a "salary" table that selects the average (using "avg") salary and returns it to a "avg_sal" variable. He includes the full PHP code you'll need and the SQL to make it all work.

0 comments voice your opinion now!
stored procedures mysql tutorial introduction

Link: http://www.sitepoint.com/stored-procedures-mysql-php

blog comments powered by Disqus

Similar Posts

PPI Framework Blog: Tutorial: GeoLocation with FourSquare and Google Maps

MT-Soft Blog: Creating a secure PHP production environment from Source Code

NETTUTS.com: How to Create a PHP/MySQL Powered Forum from Scratch

Deepak Radhakrishnan\'s Blog: Configuring Apache - PHP - MySQL on Windows (WAMP Configuration)

Kevin van Zonneveld: It's Almost 2014 and We Are Still Committing Broken Code


Community Events





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


tool opinion language security community symfony version framework composer introduction mvc voicesoftheelephpant laravel package release update interview podcast series library

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