How to Convert MySQL to MySQLi PHP Code to Upgrade to PHP7 Doing the PHP MySQL MySQLi Migration
Complete tutorial article: https://www.phpclasses.org/blog/package/9199/post/3-Smoothly-Migrate-your-PHP-Code-using-the-Old-MySQL-extension-to-MySQLi.html
Hello this is Dave Smith author of how to convert MySQL to MySQLi and developer of the PHP MySQL to MySQLi package, both of which can be found on the PHPClasses.org Web site. The links will be available in the description below.
PHP 7 no longer supports the mysql extension, so any legacy code using the mysql extension will need to be migrated to either PDO or mysqli before it can run on a server running PHP 7 or above.
This article will give you examples of how to connect using mysqli and how to migrate the mysql methods to the mysqli procedural methods giving code examples for some of the simple changes to some of the more difficult ones too, even for the ones that do not have a replacement in mysqli we give you code that will help you to actually operate the mysql as if in a mysqli environment.
I also want to take a moment to talk about the mysql to mysqli package. This package was intended to be included in legacy code using the mysql extension that can be included in PHP versions 5.6 and below and it will just sit there and it waits for the mysql extension to go away.
So when the server updates to PHP 7 or above then the package will take over and it will keep the mysql legacy code from crashing your scripts.
It is intended as a stop gap is intended as to keep things running until you get an opportunity to actually get in and change and do the migration from mysql to mysqli once again it is recommended that you use this only as a stopgap that you do eventually perform the migration from mysql to either PDO or mysqli.
I hope that you find the article informative. Remember that you can also comment if you have any problems and I will get right back to you and help you work them out. Thank
you for your time. Bye.
source