Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/253845-redesign-poll-for-new-site-design/
Share on other sites

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.