gaogier Posted December 26, 2011 Share Posted December 26, 2011 Hello I am looking to redesign an old poll system what approved to work effeciantly, however I now need to get the poll to work on my new site. I am getting these errors. Warning: mysql_query() [function.mysql-query]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/gaogier/public_html/includes/polls.php on line 4 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/gaogier/public_html/includes/polls.php on line 4 Warning: mysql_query() [function.mysql-query]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/gaogier/public_html/includes/polls.php on line 52 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/gaogier/public_html/includes/polls.php on line 52 Code is on pastebin - 24 hours. http://pastebin.com/1u19Xwwk Now here is where my files are located includes/connect.php includes/polls.php pages/ - my pages.php - displayed as a new folder almost using mod rewrite. tpl/sidebar.tpl - where my poll will be displayed using php - include. Quote Link to comment https://forums.phpfreaks.com/topic/253845-redesign-poll-for-new-site-design/ Share on other sites More sharing options...
scootstah Posted December 26, 2011 Share Posted December 26, 2011 Isn't it pretty obvious? Warning: mysql_query() [function.mysql-query]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/gaogier/public_html/includes/polls.php on line 4 So check your database connection code. Quote Link to comment https://forums.phpfreaks.com/topic/253845-redesign-poll-for-new-site-design/#findComment-1301379 Share on other sites More sharing options...
gaogier Posted December 26, 2011 Author Share Posted December 26, 2011 The same file connect to the same database for everything on the site. which all works. Quote Link to comment https://forums.phpfreaks.com/topic/253845-redesign-poll-for-new-site-design/#findComment-1301423 Share on other sites More sharing options...
jcbones Posted December 27, 2011 Share Posted December 27, 2011 You include connect.php in your poll.php file with a relative file path. This will work if you are accessing poll.php itself, but will not work if poll.php is included in another file, as that file will do the include. So, PHP is looking in the pages/ folder for the file connect.php. You should put an absolute file path to the connect file. require_once ('absolute/path/to/connect.php'); This is the exact reason that so many of us stress that you must use absolute file paths to every included file. Quote Link to comment https://forums.phpfreaks.com/topic/253845-redesign-poll-for-new-site-design/#findComment-1301489 Share on other sites More sharing options...
gaogier Posted December 27, 2011 Author Share Posted December 27, 2011 I commented out the connect and poll now works for some unknown reason. Quote Link to comment https://forums.phpfreaks.com/topic/253845-redesign-poll-for-new-site-design/#findComment-1301649 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.