PHP Classes

PHP MySQL to MySQLi: Replace mysql functions using the mysqli extension

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (27)   Blog (3)    
Last Updated Ratings Unique User Downloads Download Rankings
2017-09-06 (6 months ago) RSS 2.0 feedStarStarStarStar 76%Total: 3,737 This week: 25All time: 860 This week: 21Up
Version License PHP version Categories
mydql2i 1.6Public Domain5PHP 5, Databases
Description Author

This class can replace the mysql functions using the mysqli extension.

It provides equivalent functions that perform the same operations as the mysql extension when this is not available.

An auxiliary script is provided to provide global functions with the same names and parameters as mysql extension functions except that they call the class to use the mysqli extension.


PHP MySQL to MySQLi: Replace mysql functions using the mysqli ex
how to Replace mysql with MySQLi functions using the mysqli

Best PHP mysql to mysqli or PDO solution
How to convert mysql code to use mysqli?

mysql to mysqli
looking for mysql2i

Innovation Award
PHP Programming Innovation award winner
June 2015

Prize: One downloadable copy of PhpED Professional
The original MySQL extension is being deprecated and will be removed from the core starting from PHP 7.

There is a lot of legacy applications that need to be updated to either move to mysqli or PDO extensions so they can work on PHP 7.

However, this process is not always trivial, as it is not just a matter of replacing the names of functions that are called.

This package provides a quick replacement of the mysql extension functions that use the mysqli extension functions instead. This way the legacy application can continue to work on PHP 7 or later with minimal changes.

Manuel Lemos
  Performance   Level  
Name: Dave Smith is available for providing paid consulting. Contact Dave Smith .
Classes: 37 packages by
Country: United States United States
Age: 52
All time rank: 12112 in United States United States
Week rank: 7 Up1 in United States United States Up
Innovation award
Innovation award
Nominee: 26x

Winner: 6x


The problem

PHP has deprecated the mysql extension which will be removed in PHP 7. Even though it was recommended to use the improved extension, mysqli, many developers continued to use mysql.

The effect

Once PHP 7 is released in mid November of this year, 2015, many hosted servers will upgrade and scripts still relying on the old mysql extension will fail.

There are lot of web sites using legacy packages that are no longer supported by the developer and not all developers have had time to update their current packages to the improved mysqli extension.

The solution

The PHP mysql to mysqli package was developed to be the stop gap to keep everything working smoothly.

It can be placed in any PHP script, at anytime, and when the mysql extension disappears, it will take over. It works by defining functions using the old mysql function names and passing the arguments to the class methods that will use the improved mysqli extension.

  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example Example Usage
Plain text file mysql2i.class.php Class Main Class
Accessible without login Plain text file mysql2i.func.php Aux. Functions
Accessible without login Plain text file Doc. Additional Information

 Version Control Unique User Downloads Download Rankings  
This week:25
All time:860
This week:21Up
User Ratings User Comments (10)
 All time
Very usefull package.
4 months ago (zinsou A.A.E.Mo´se)
Worked on an old piece of complex rats nest coding very well
6 months ago (jon washtell)
1 year ago (Pedro Garcia)
1 year ago (muabshir)
Thanks a lot for this code!!
1 year ago (Thierry Lemaire)
Thanks for your great work.
1 year ago (Paco Perez)
"does what is says on the tin" thanks.
2 years ago (Fred Mac Donald)
Excellent support by the author
2 years ago (Heinz Ernst)
Great and very useful! Thank you for sharing this.
2 years ago (Terry Woody)
Thanks for the class, its really useful.
2 years ago (Saahisht Paul)