pthurmond Posted November 15, 2006 Share Posted November 15, 2006 I am getting the following error on one of my pages:[quote]Warning: mysql_query(): Access denied for user 'nobody'@'localhost' (using password: NO) in /home/phatgod/public_html/PALsys/includes/activity_funcs.php on line 45Warning: mysql_query(): A link to the server could not be established in /home/phatgod/public_html/PALsys/includes/activity_funcs.php on line 45Query failed: Access denied for user 'nobody'@'localhost' (using password: NO)[/quote]The code it is refering to is: [code]session_start(); require_once('config.php'); //Connect to the db $local = $_SESSION['location']; $today = date("Y-n-j"); //Current query status $query = "SELECT Activities FROM Events WHERE Date = '$today' AND Center_ID = '$local' "; //Run the query $result = mysql_query($query) or die('Query failed: ' . mysql_error()); //Read the activities from the database into an array if($result) { $row = mysql_fetch_array($result, MYSQL_NUM); $astring = $row[0]; //Reads in the string of activities } else { $message .= '<p>Your search could not be completed due to a system error.</p><p>' . mysql_error() . '</p>'; } [/code]The config.php file is the same one I use to connect to the db with all of my other scripts on this site, it works fine with other scripts.This code comes from a function that is being called.Any ideas?Thanks,Patrick Link to comment https://forums.phpfreaks.com/topic/27316-problem-troubleshooting-an-sql-error/ Share on other sites More sharing options...
cunoodle2 Posted November 15, 2006 Share Posted November 15, 2006 Patrick, Are all of the files in the exact same directory? Cause if not you have to modify you "require_once" path. It is saying "user nobody" so either the file is filled out improperly or it is looking in the incorrect path for the file. Check the directory and then again try running a different file that also calls this exact same config.php file.As a random side note here are you 100% sure that it is the "config.php" file that you are supposed to be including? Please copy and paste the contents of that file in here as well. Be sure to block out any usernames and passwords to be on the safe side. Let us know and we will continue from there. Link to comment https://forums.phpfreaks.com/topic/27316-problem-troubleshooting-an-sql-error/#findComment-124908 Share on other sites More sharing options...
pthurmond Posted November 15, 2006 Author Share Posted November 15, 2006 Well the function I am calling is in a file in the same directory that the config.php file is in. However the program that is calling it is one directory below. Now if I include the config.php file in the script that is calling the function, do I still need to include it in the file that contains the function too?Here is the layout:/script.php/includes/config.php/includes/activity_funcs.phpThanks,Patrick Link to comment https://forums.phpfreaks.com/topic/27316-problem-troubleshooting-an-sql-error/#findComment-125074 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.