From 1c97695e49963bda92fcb368fab7241c16137bd1 Mon Sep 17 00:00:00 2001 From: quix0r Date: Thu, 20 Jun 2013 20:56:23 +0000 Subject: [PATCH] MySQLi requires at least a link resource for all its functions/methods #3 --- inc/db/lib-mysqli.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/inc/db/lib-mysqli.php b/inc/db/lib-mysqli.php index 46b343fba0..29c49158e4 100644 --- a/inc/db/lib-mysqli.php +++ b/inc/db/lib-mysqli.php @@ -93,7 +93,7 @@ function sqlQuery ($sqlString, $file, $line, $enableCodes = TRUE) { // Run SQL command //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'file=' . basename($file) . ',line=' . $line . ',sql=' . $GLOBALS['last_sql']); $result = mysqli_query(getSqlLink(), $GLOBALS['last_sql']) - or sqlError($file, $line, 'file='. basename($file) . ',line=' . $line . ':mysqli_error()=' . mysqli_error() . ',last_query=' . $GLOBALS['last_sql']); + or sqlError($file, $line, 'file='. basename($file) . ',line=' . $line . ':mysqli_error()=' . mysqli_error(getSqlLink()) . ',last_query=' . $GLOBALS['last_sql']); //* DEBUG: */ logDebugMessage($file, $line, 'sql=' . $GLOBALS['last_sql'] . ',affected=' . sqlAffectedRows() . ',numRows='.(isValidSqlLink($result) ? sqlNumRows($result) : gettype($result))); // Calculate query time @@ -197,7 +197,7 @@ function sqlResult ($resource, $row, $field = '0') { // SQL connect function sqlConnectToDatabase ($host, $login, $password, $file, $line) { // Try to connect - $linkResource = mysqli_connect($host, $login, $password) or sqlError($file, $line, mysqli_error()); + $linkResource = mysqli_connect($host, $login, $password) or sqlError($file, $line, mysqli_error(getSqlLink())); // Set the link resource if ($linkResource instanceof mysqli) { @@ -236,7 +236,7 @@ function sqlSelectDatabase ($dbName, $file, $line) { // Return the result //* DEBUG: */ logDebugMessage($file . ':' . __FUNCTION__, $line . ':' . __LINE__, 'Selecting database ' . $dbName); - return mysqli_select_db(getSqlLink(), $dbName) or sqlError($file, $line, mysqli_error()); + return mysqli_select_db(getSqlLink(), $dbName) or sqlError($file, $line, mysqli_error(getSqlLink())); } // SQL close link @@ -249,7 +249,7 @@ function sqlCloseLink ($file, $line) { } // END - if // Close database link and forget the link - $close = mysqli_close(getSqlLink()) or sqlError($file . ':' . __FUNCTION__, $line . ':' . __LINE__, mysqli_error()); + $close = mysqli_close(getSqlLink()) or sqlError($file . ':' . __FUNCTION__, $line . ':' . __LINE__, mysqli_error(getSqlLink())); // Close link in this layer unsetSqlLinkUp(__FUNCTION__, __LINE__); -- 2.39.5