Yes, ‘i’ makes a difference…and for those working in MySQL there could be no better way getting it proved. Shift to MySQLi… the latest extension for PHP5 that will support all the features in MySQL version 4.1 and more. Why would anyone like to switch to ext/mysqli … let’s have a deeper insight into it.
4 reasons to shift to MySQLi:
- Greater speed: the modified features in MySQLi have made operations faster. Can you believe now you can perform a task in MySQLi 40 times faster as compared to ext/mysql!?
- Better security: In the older versions of the MySQL RDBMS, the possibility of a hacker getting hold of the weak passwords from the network is high whereas, the authentication procedure in MySQLi is much more robust.
- Easy to maintain: The ext/mysql code is somewhat complex and messy as its features have to be enabled and disabled manually according to the various versions whereas, the features of MySQLi are compatible with all the versions.
- Backwards compatibility: Although the compatibility between ext/mysql and ext/mysqli is not perfect, effort has been made to simplify porting applications from ext/mysql to ext/mysqli.
The ext/mysqli supports all the new features found in recent versions of MySQL and introduces few of its own. Let’s have a look at these unique features:
- A procedural interface that looks very much like the ext/mysql interface.
- An object-oriented interface which, allows for a use idiom that is both more convenient and easier to extend than the procedural interface
- It supports the new MySQL binary protocol which, was introduced in MySQL 4.1.
- It supports full feature set of MySQL C client library, including the ability to set advanced connection options via mysqli_init() and related functions.
- And to add to the uniqueness, the extension also supports additional tracing, debugging, load balancing and replication of functionality.
There are some aspects of ext/mysqli which are quite different from the old extension. Specific features have been removed as an effort to correct certain design flaws or bug-prone behaviors like the following:
- Default database connection: If you do not explicitly connect to the server, ext/mysqli will not do it for you.
- Default link: The database server connection that you wish to use must be explicitly referenced while using ext/mysqli via its procedural context, i.e. mysqli_query($link, $query);
Note that open connections (and similar resources) are automatically destroyed at the end of script execution. However, you should still close or free all connections, result sets and statement handles as soon as they are no longer required. This will help to return resources to PHP and MySQL faster.
I would be talking more on MySQLi…there is a lot more to come. Stay tuned !!!