php
is about to stop support for mysql
functions, and there are lots of tools/recommendations for how to upgrade to upgrade to mysqli from mysql. I came up with this design, and I wonder if there are any issues that my solutions can have:
- Create a file called translate.php and require_once it in all php files that use any mysql functions.
- Create global variable in that file and call it $_CONN
- overwrite default mysql function with the following (using overwrite_function which is not shown here)
$_CONN;
mysql_query($q)
{mysqli_query($_CONN,$q);}
mysql_error()
{mysqli_error($_CONN);}
mysql_connect($h,$u,$p)
{$_CONN=mysqli_connect($h,$u,$p);}
mysql_fetch_assoc($r)
{mysqli_fetch_assoc($r);}
mysql_fetch_array($r)
{mysqli_fetch_array($r);}
Are there any issues with my solution?