2012-07-21 97 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