define('DB_HOST', 'localhost');
define('DB_USER', '****');
define('DB_PWD', '****');
define('DB_NAME', 'login_in_infor');
define('DB_CHARSET', 'utf8');
?>
include 'config.php';
$link=mysqli_connect('DB_HOST', 'DB_USER', 'DB_PWD', 'DB_NAME');
if(mysqli_errno($link))
{
mysqli_error($link);
exit;
}
mysqli_set_charset($link, 'DB_CHARSET');
?>
header('Content-Type:text/html;charset=utf-8');
include 'connection.php';
$count_sql="select count(id) as c from login_in";
$result_count=mysqli_query($link,$count_sql);
if($result_count)
{
$data=mysqli_fetch_assoc($result_count);
$count=$data['c'];
echo $count;
}
else {
echo '连接错误';
}
?>
显示出错,在第三个文件中找不到$link变量。