I'm a fairly novice coder and have an issue I'm hoping someone could help me with.
I am following a series of tutorials and I have had moderate success in being able to follow along and even more intriguing is that the site connects to the DB and displays the contents of the DB where requested but when I try to execute a function I'm working on I get an access denied using password NO message.
here's how my function looks
function Member_Data($user_id) {
$data = array();
$user_id = (int)$user_id;
$func_num_args = func_num_args();
$func_get_args = func_get_args();
if($func_num_args > 1) {
unset($func_get_args[0]);
$fields = '`' . implode('`, `', $func_get_args) . '`';
$data = mysql_fetch_assoc(mysql_query("SELECT $fields FROM `members` WHERE `ID` = $user_id"));
echo mysql_error();
print_r($data);
//die();
//return $data;
}
}
and in head.php before the tag I have
if(loggedin() === true) {
$Session_memberID = $_SESSION['memberID'];
$MemberData = Member_Data($Session_memberID, 'ID', 'FName', 'LName', 'Email', 'Password');
}
But when I try to retrieve the data (ie: print_r($data);) I get a blank screen but when I add in echo mysql_error(); I get: Access denied for user 'obscuredforsecurity'@'localhost' (using password: NO)
But all the other pages connect fine as well as I was not having a problem connecting for other tutorials but for some reason (unbeknownst to me) I can't get it to connect so I can follow through with this tutorial.
If anyone wouldn't mind sharing with me what I'm doing wrong, I'd be most appreciative and I thank you all once again.
Stuart K