2012-07-21 131 views
0

我無法使用mysqli類登錄到數據庫。PHP MySQLi無法識別登錄信息

我得到了一個錯誤:

Warning: mysql_query(): Access denied for user 'www-data'@'localhost' (using password: NO) 

我有下面的代碼:

$this->mysqlCon = new mysqli($siteConfig['db']['hostname'], $siteConfig['db']['username'], $siteConfig['db']['password'], $siteConfig['db']['database']); 

$siteConfig['db']回報var_dump()

array(4) { 
    ["hostname"]=> 
    string(9) "localhost" 
    ["username"]=> 
    string(4) "root" 
    ["password"]=> 
    string(*) "***Censored***" 
    ["database"]=> 
    string(*) "***Censored***" 
} 

我的VPS運行的Debian 6 32位

在此先感謝。

回答

1
Warning: mysql_query() 
      ^---------------------- notice something? :) 

你似乎在代碼中混合了mysqlmysqli

+0

我的英雄! :D我混合了我的朋友提供的一個腳本,用於學習,並且好像我的眼睛在mysqli和mysql之間無法區別。謝謝 :) – Novak 2012-07-22 10:26:59