From 79c95a4a1bae19764b24869a50eb1102299419a1 Mon Sep 17 00:00:00 2001 From: tianya Date: Sat, 16 Apr 2022 19:12:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3sql=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/system/common.func.php | 6 ++++++ src/system/taglib/sql.lib.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/system/common.func.php b/src/system/common.func.php index efaae505..0035e896 100755 --- a/src/system/common.func.php +++ b/src/system/common.func.php @@ -39,6 +39,12 @@ if (version_compare(PHP_VERSION, '7.0.0', '>=')) { return mysqli_close($link); } } + if (!function_exists('mysql_free_result') and function_exists('mysqli_free_result')) { + function mysql_free_result($result) + { + return mysqli_free_result($result); + } + } if (!function_exists('split')) { function split($pattern, $string) { diff --git a/src/system/taglib/sql.lib.php b/src/system/taglib/sql.lib.php index f4ae9213..fbeade6b 100755 --- a/src/system/taglib/sql.lib.php +++ b/src/system/taglib/sql.lib.php @@ -43,7 +43,7 @@ function lib_sql(&$ctag, &$refObj) //链接数据库 $linkid = @mysql_connect($config['dbhost'], $config['dbuser'], $config['dbpwd']); if (!$linkid) return ''; - @mysql_select_db($config['dbname']); + @mysql_select_db($config['dbname'], $linkid); $mysqlver = explode('.', $dsql->GetVersion()); $mysqlver = $mysqlver[0].'.'.$mysqlver[1]; //设定数据库编码及长连接