MySQLi or MySQL, this is the question
September 2, 2008
Filed under
Development, PHP
As of PHP5, a new improved version of MySQL connector is available. It’s called MySQLi, which stands for “MySQL Improved”. I had to think a lot about what the “i” stands for, but it seems that the guys (or gals) who developed the extension has the same, endless imagination as the PHP developers has.
So, a few words about MySQLi. The first improvement is that it’s object oriented (OO) so it’s extremely easy to use in OO PHP codes. It can be used in the traditional way too, but its real power hides in the OO.
In the standard MySQL queries every should be escaped using mysql_real_escape_string(). This can be a tiny drawback as every single bit in a script will reduce execution time. On the other hand, MySQLi escapes every variable from a query automatically.
Did you try to connect to the MySQL server on secure connection ever? You can’t. It doesn’t support it. With MySQLi you can use secure connection to connect, this means for you increased security.
So, what’s the verdict? MySQLi or MySQL
I say, if you have time and you want to write an OO application, choose MySQLi. This if you develop new application from scratch and you have time to figure out how to use it.
To switch an existent well-designed application on the other hand I don’t recommend MySQLi. While the performance of MySQLi is way better than MySQL’s in some situations, running common queries with MySQLi will not increase your application’s performance.
Possible related posts (automatic):
Related posts brought to you by Yet Another Related Posts Plugin.



















Comments
Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!
If you want to use your OpenID, fill out the field labeled "Website" with the OpenID URL. The other fields may remain empty.