我不斷收到此錯誤:ini文件正確
警告:mysql_connect()函數:未知MySQL服務器主機 '大象'(1)4
我的ini文件是這樣的:
[Database]
DBHostName = "localhost"
DatabaseName = "elephant"
DBUserName = "elephant"
DBPassword = "practice"
[Config]
ConfigTableName = "stage2_config"
Skin="purple"
我的文件讀取ini文件並給出了錯誤是這個與雙粗體星的線。我不知道這裏發生了什麼,爲什麼它說主機不是本地主機。
<?php
$gv_SystemTest = "<h2>system.php has been included</h2>";
$gv_SystemFileInfo = pathinfo(__FILE__);
$gv_SystemDirectory = $gv_SystemFileInfo['dirname'] . '/';
$gv_SystemINIpath = $gv_SystemDirectory . '';
$gv_SiteGlobals = parse_ini_file($gv_SystemINIpath . $_SERVER['WIA_SYSTEM_INI'], true);
function echoContent($p_ContentID) {
global $gv_SiteGlobals;
$fv_dbLink = mysql_connect($gv_SiteGlobals['Database']['DBHostName'],
$gv_SiteGlobals['Database']['DBUserName'],
$gv_SiteGlobals['Database']['DBPassword']);
**mysql_connect($gv_SiteGlobals['Database']['DatabaseName']);**
$fv_TheQuery = "select *from wia_content where content_id = $p_ContentID";
'error_log中(的print_r($ gv_SiteGlobals,1));'看什麼回報。 – mkaatman
** mysql_connect($ gv_SiteGlobals ['Database'] ['DatabaseName']); **爲什麼你會使用這一行 –