Wednesday, December 12, 2012

How To Use MySQL Stored Procedures For PHP Development


How To Create MySQL Stored Procedures
DELIMITER //
CREATE PROCEDURE SelectAllProducts()
BEGIN
SELECT * FROM products;
END //
DELIMITER ;

in above syntax SelectAllProducts is PROCEDURE Name
And products is your table name

How to call Stored Procedures

After creation of SP You have to require call procedure
use following syntax

CALL STORED_PROCEDURE_NAME()

or in our present case procedure name is SelectAllProducts so
syntax is

CALL SelectAllProducts()

then you wiil get all product list.
Connect with us for reading more blog regarding PHP WITH Stored Procedures
if you like this post then please like the blog.