Still using the old MySQL driver? What you need to know about MySQLi…

Its time to upgrade from the PHP MySQL extension

The PHP MySQL extension was deprecated in PHP 5.5.0!

You should upgrade your code to use MySQLi at least, even better would be upgrading to PDO.

This post about selecting data uses PDO and has the full source code available for you.

But back to MySQLi

The “i” in mysqli stands for IMPROVED, its not only new it’s improved too.

If you are still using the plain old mysql driver you should check to see if you can use mysqli.

All you need is PHP 5.4 or greater and add that “i”!

Once you get to PHP 5.5 or above mysql will no longer be supported.

Your queries will run faster, be more efficient and you can make use of more great features like prepared statements and it’s object oriented interface.

If you are using a PHP framework like CodeIgniter, switching should be a breeze, you just need to add the “i”.

For example you might have this in your code:

$db['default']['dbdriver'] = 'mysqli';

If you aren’t using a framework, please consider upgrading your code, depending on your hosting company they might upgrade their PHP version without warning!

It has happened before!

Then you will need to be fixing and upgrading your code under pressure while your website is down!