Sunday, 14 September 2014

Mysql Stored Procedure in PHP

Are you making stored procedures if not please have a look at this. Stored procedures can help to improve web applications and reduce database requests traffic. This post explains you how to make procedures and decrease database requests.

Database
users table contains username and name.
Result.php (Direct database server access)
Calling SQL statements directly. Here displaying the users content with PHP.
I had implemented Stored Procedure at huzoorbux.com
How to Create Stored Procedure
You can create stored procedures that run on your database server. Stored Procedure name userIDName(). Just like SQL statements.
How to Call Stored Procedure
Results.php (With stored procedures)
Stored Procedure Input
Simple Way
insert procedure IN – Input , name and datatype.
 Nice Way
I suggest you to create stored procedures with following statements.
 Insert.php
Here inserting values into users table with calling insert() procedure.
 DataBase.php Database configuration code.
 Feel free to ask your question :-)

No comments:

Post a Comment