Browse Source

增加数据库错误提示

tags/6.2.7
tianya 1 year ago
parent
commit
3ecf3896c0
2 changed files with 15 additions and 1 deletions
  1. +2
    -1
      src/install/index.php
  2. +13
    -0
      src/system/common.func.php

+ 2
- 1
src/install/index.php View File

@@ -276,9 +276,10 @@ else if ($step==10) {
);
echo json_encode($result);
} else {
$err = mysql_error();
$result = array(
"code" => -1,
"data" => "数据库连接失败",
"data" => "数据库连接失败,错误信息:{$err}",
);
echo json_encode($result);
}


+ 13
- 0
src/system/common.func.php View File

@@ -72,6 +72,19 @@ if (version_compare(PHP_VERSION, '7.0.0', '>=')) {
}
}
}
if (!function_exists('mysql_error') and function_exists('mysqli_connect_error')) {
function mysql_error($link='')
{
if (mysqli_connect_errno()) {
return mysqli_connect_error();
}
if ($link) {
return @mysqli_error($link);
} else {
return false;
}
}
}
if (!function_exists('mysql_free_result') and function_exists('mysqli_free_result')) {
function mysql_free_result($result)
{


Loading…
Cancel
Save