I did not write any past experience and knowledge that i gain for the past 3 years which something that i regret really much, but as for today and the next new year which coming very soon, i'll start recording all the things that i learn for that day. May this little essay will help me in future and so any who stumble upon this :D.Ok back to the topic for this post.
Things that i learn today is using stored procedures with PHP.
Why use stored procedures??My past experience in developing system really show me how stored procedures could prevents troubles in the futures.
1. Security
The precompiled sql script make it more secured rather than scripting it on the codes. Futuremore for open source where everyone can see codes behind, having the sql script on the codes is really like exposing the site secret weapons. Database is a spine for any system hence it should be handle with care.
2. System performance
First system that i develop once i start my working life is using ASP.net and oracle 9i. I really learnt a lot by doing the project.My biggest problem that i had while developing the web reporting is performance. My system running a very complex script on the client side which makes the page is taking more than 10 seconds to load. As for my experience the standard response time for the client to get the feedback from the server is 3 seconds.
3. Feasibility
Another good thing that we get by using stored procedures is it makes the programmer's work lots easier to change the sql script if any changes needed. Reading 3 thousands lines of codes to make changes on one lines of codes is not a fun things to do.
It maybe lot more of benefits using stored procedures but so far this what i learnt by my past experiences.Using stored procedures also have a drawback, but for me the benefits out-weight it. Hence for next development that i will do on this University, i'll try to apply this and fully using it.
Most common database the developer use while developing using PHP is mySQL, so i will start with this.The key word to use Stored Procedures in PHP is CALL. Yea..just use CALL than the stored procedures name at the back.
Another thing that i learn is for other database, PHP have another class,PDO. according to http://us.php.net/manual/en/class.pdo.php , it '
Represents a connection between PHP and a database server'
I never really finish reading whole http://us.php.net/manual/.. It's like big dictionary which i use when i need to look for something. A few sites that i found helpful for this topics is
1. http://www.joeyrivera.com/2009/using-mysql-stored-procedures-with-php-mysqlmysqlipdo/
This one is what i refer most of time. The explanation is simple and easy to understand even for a newbie likes me.
2. http://us.php.net/manual/en/class.pdo.php
3. google it!! the best things about open source is you can find thousands of articles, forums and white paper to refer to. Come from industrial design background and jump into a programmer, i kept the habit of hating reading words and straight to numbers/codes/images.
No comments:
Post a Comment