Created
January 23, 2026 13:57
-
-
Save ismail0234/f97e3f72e3a285f27482f845a7566500 to your computer and use it in GitHub Desktop.
mysql_query to mysqli_query
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if (!function_exists('mysql_connect')) | |
| { | |
| $GLOBALS['dbConnection'] = null; | |
| function mysql_connect($a, $b, $c, $d) | |
| { | |
| $GLOBALS['dbConnection'] = mysqli_connect($a, $b, $c, $d); | |
| return $GLOBALS['dbConnection']; | |
| } | |
| function mysql_query($query, $conn = null) | |
| { | |
| if ($conn == null) | |
| { | |
| $conn = $GLOBALS['dbConnection']; | |
| } | |
| return mysqli_query($conn, $query); | |
| } | |
| function mysql_fetch_assoc($query) | |
| { | |
| return mysqli_fetch_assoc($query); | |
| } | |
| function mysql_fetch_array($query) | |
| { | |
| return mysqli_fetch_array($query); | |
| } | |
| function mysql_real_escape_string($param) | |
| { | |
| if(is_array($param)) | |
| return array_map(__METHOD__, $param); | |
| if(!empty($param) && is_string($param)) { | |
| return str_replace(array('\\', "\0", "\n", "\r", "'", '"', "\x1a"), array('\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'), $param); | |
| } | |
| return $param; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment