News Feed
Sections




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

Rubayeet Islam's Blog:
MySQL Prepared Statements and PHP A small experiment
October 30, 2008 @ 11:13:58

In a recent post to his blog Rubayeet Islam compared the more traditional way of running a query in MySQL versus a prepared statement with the MySQLi extension.

Consider a PHP-MySQL application where the information of 1000 users is being retrieved from the database by running a for loop [...] in each iteration, the first thing the MySQL engine does is to parse the query for syntax check. Then it sets up the query and runs it. Since the query remains unchanged during each iteration(except for the value of user_id), parsing the the query each time is definitely an overhead. In such cases use of prepared statements is most convenient.

He explains what prepared statements are and some of the advantages around them and includes some benchmarking examples to show the differences - about a five second jump in favor of MySQLi.

0 comments voice your opinion now!
mysqli prepared statement tutorial benchmark


blog comments powered by Disqus

Similar Posts

Ariz Jacinto's Blog: Compiling PHP with MSSQL Server's Native ODBC Driver for Linux as a PDO Driver

Rob Zienert's Blog: Zend_Form Decorators and Composite Elements

Colin Viebrock\'s Blog: MySQLi in PHPAdsNew 2.0.7

DevShed: Introduction to Using SQLite with PHP 5

MrPHP.com.au: Image Cache using phpThumb and .htaccess


Community Events





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


language podcast symfony release community application series install laravel bugfix code unittest configure wordpress introduction interview library developer api list

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