<?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');
?>
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 {
}
?>
顯示錯誤,在第三個檔案中尋找小於$link 變量。
全域變數怎麼還有單引號
常數可以直接使用
$link=mysqli_connect('DB_HOST', 'DB_USER', 'DB_PWD', 'DB_NAME');
去掉單引號