5,8 → 5,9 |
// TODO: check if we matched all stuff mentioned here: https://www.phpclasses.org/blog/package/9199/post/3-Smoothly-Migrate-your-PHP-Code-using-the-Old-MySQL-extension-to-MySQLi.html |
|
$vts_mysqli = null; |
$vts_mysqli_report_set_once = false; |
|
// Liefert die Anzahl betroffener Datensätze einer vorhergehenden MySQL Operation |
// Liefert die Anzahl betroffener Datensätze einer vorhergehenden MySQL Operation |
function mysql_affected_rows($link_identifier=NULL) { |
global $vts_mysqli; |
$li = is_null($link_identifier) ? $vts_mysqli : $link_identifier; |
33,9 → 34,10 |
return $li->close(); |
} |
|
// Öffnet eine Verbindung zu einem MySQL-Server |
// Öffnet eine Verbindung zu einem MySQL-Server |
function mysql_connect($server=null, $username=null, $password=null, $new_link=false, $client_flags=0) { |
global $vts_mysqli; |
global $vts_mysqli_report_set_once; |
$ary = explode(':', $server); |
$host = $ary[0]; |
$ini_port = ini_get("mysqli.default_port"); |
44,6 → 46,10 |
if (is_null($username)) $port = ini_get("mysqli.default_user"); |
if (is_null($password)) $port = ini_get("mysqli.default_password"); |
$vts_mysqli = new mysqli($host, $username, $password, /*dbname*/'', $port, ini_get("mysqli.default_socket")); |
if (!$vts_mysqli_report_set_once) { |
mysqli_report(MYSQLI_REPORT_OFF); // PHP <8.1 compatibility |
$vts_mysqli_report_set_once = true; |
} |
return (empty($vts_mysqli->connect_error) && ($vts_mysqli->connect_errno == 0)) ? $vts_mysqli : false; |
} |
|