I am using Jquery.load
to load an external file with html/php content into one div. It loads the file, and displays what it's supposed to except it says access denied www-data@localhost password: no
where it should be echoing some content.
I know that the main page, not the one being loaded, is connected to the db using require_once("assets/functions/config.php");
to call on my php file that contains the connection.
What am I doing wrong? It's probably simple, and I'm overlooki开发者_运维知识库ng something.
EDIT: Okay on the index.php above <html>
I have:
<?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 is as follows:
<?
// 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');
});
External File to Load:
<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>
This looks like the php script that your jQuery function is calling is trying (and failing) to open an SSH session.
精彩评论