Skip to content

Instantly share code, notes, and snippets.

@wilcorrea
Created December 2, 2016 12:43
Show Gist options
  • Save wilcorrea/600f8ab92961e38a13704346718a465e to your computer and use it in GitHub Desktop.
Save wilcorrea/600f8ab92961e38a13704346718a465e to your computer and use it in GitHub Desktop.
<?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