<?php
// 系统设置
include '/config.inc.php';
// 连接并选择数据库
$mysqli = new mysqli(DATABASE_HOSTNAME, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_DATANAME);
// 判断连接是否成功
if ($mysqli->connect_errno) {
printf("不能连接数据库,错误是: %s\n", $mysqli -> connect_error);
exit();
}
// SQL查询语句
$sql = "select * from Company_Info";
// 运行SQL查询
if ($result = $mysqli -> query($sql))
{
// 读取数据
while ($row = $result -> fetch_array(MYSQLI_ASSOC))
{
// 读取特定字段
$CompanyName = $row['CompanyName'];
}
// 结束查询释放内存
$result -> close();
}
else echo($mysqli -> error);
// 使用完毕关闭数据库连接
$mysqli -> close();
?>
<?php
echo "Copyright © 2017-" . date("Y") . " " . $CompanyName . " 版权所有.";
?>