2011-10-06 100 views
0

我使用Jquery.load将带有html/php内容的外部文件加载到一个div中。它加载文件,并显示它应该是什么,除非它说access denied [email protected] password: no它应该回显一些内容。拒绝访问www-data @ localhost

我知道,主页,而不是被加载的,连接到数据库使用require_once("assets/functions/config.php");调用我的PHP文件,其中包含连接。

我在做什么错?这可能很简单,我忽略了一些东西。

编辑:上的index.php好上述<html>我有:

<?PHP 
    require_once("assets/functions/config.php"); 
    //if ($notInstalled == 1) header("Location: install"); 
    require_once("assets/functions/functions.php"); 
    if ($users->checkAuth() == 0) { 
    header("Location: login.php"); 
    exit; 
    } 
    $currentUser = $_COOKIE['vetelixir_username']; 
?> 

的config.php如下:

<? 
// MySQL Database 
$db_host = "localhost"; 
$db_name = "dbname"; 
$db_username = "username"; 
$db_password = "password"; 

// Connect to the database 
$connection = @mysql_connect($db_host,$db_username,$db_password) or die(mysql_error()); 
$db = @mysql_select_db($db_name,$connection)or die(mysql_error()); 
// end MySQL 
?> 

的jQuery:

$("#button").click(function() { 
    $('#content').load('pages/external.php'); 
}); 

外部文件,以负载:

<div id="div"> 
<? 
    $currentBlah = mysql_query("SELECT `firstname`,`lastname` FROM `blah` ORDER BY `lastname` ASC") or die(mysql_error()); 

    while($u = mysql_fetch_array($currentBlah)) { 

    echo "<div class='clientRow'><span class='name'>".$u['firstname']." ".$u['lastname']."</span></div>"; 

    } 
?> 
</div> 
+1

发表了一些真实的代码plz。 – lostyzd

+1

这看起来像是一个MySQL认证被拒绝的消息。您是否正确地对数据库进行身份验证?这实际上与jQuery无关,可能与PHP无关。调试你的代码,看看你如何连接到数据库。 – David

+0

意味着你的'.php'没有成功登录到你的mysql,请仔细检查。 – Rufus

回答

0

这看起来像您的jQuery函数调用的php脚本尝试(和失败)打开SSH会话。

+0

该消息是MySQL错误消息。 – birryree

+0

birryree是对的它是MySQL。 – Anirath