我是 PHP 和 MYSQL 的新手。我尝试了一些使用 xampp 的学习。当我尝试使用脚本连接数据库时,它显示以下错误..这显示在 index.php
致命错误:无法在第 24 行的 C:\xampp1\htdocs\core.php 中重新声明 connectdb()(之前在 C:\xampp1\htdocs\core.php:18 中声明)
我在谷歌上搜索并尝试解决这个问题。但它不起作用... core.php 第 18 到 24 行代码如下。
function connectdb()
{
global $dbname, $dbuser, $dbhost, $dbpass;`
$conms = @mysql_connect($dbhost,$dbuser,$dbpass); //connect mysql`
if(!$conms) return false;`
$condb = @mysql_select_db($dbname);`
if(!$condb) return false;`
return true;`
}
config.php 代码如下
$dbname = "aw"; //change to your mysql database name
$dbhost = "localhost"; //database host name
$dbuser = "sam";
$dbpass = "1234";
$max_buds=100; //maximum number of buds
$topic_af = 120; //topic antiflood
$post_af = 45; //post antiflood
$onver = true; //isonline versoion
$timeadjust = (0 * 60 * 60); // 4 hours
putenv("TZ=Africa/Johannesburg");