<?php
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 变量。
##
全局变量怎么还有单引号
常量可以直接使用
$link=mysqli_connect('DB_HOST', 'DB_USER', 'DB_PWD', 'DB_NAME');
去掉单引号