Created
December 2, 2016 12:43
-
-
Save wilcorrea/600f8ab92961e38a13704346718a465e to your computer and use it in GitHub Desktop.
This file contains 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')) { | |
function mysql_connect((parameters)) { | |
return MySQL::connect((parameters)); // equivalente em mysqli | |
} | |
} | |
if (!function_exists('mysql_query')) { | |
function mysql_query($sql) { | |
return MySQL::query($sql); // equivalente em mysqli | |
} | |
} | |
class MySQL { | |
private static $link; | |
public static function connect((parameters)) | |
{ | |
if (!self::$link) { | |
self::$link = mysqli_connect((parameters)); | |
} | |
return self::$link; | |
} | |
public static function query($sql) | |
{ | |
return mysqli_query(self::$link, $sql); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment