PHP connecting problems

Hello

I created a PHP script that takes information from a html page then puts in into a MySQL database. The script works ok when i use it on my laptop and local server, the problems arise when i upload it to my website as it doesn’t connect to the server.

I’ve made sure the DB host, username and password are correct but still nothing. The only difference compared to running it on my local server is where the files are located. On my website all files are in the same directory whereas on my laptop they are located under the htdocs directory. Would this be why the script is not working? And if so, where is the htdocs directory for my webhosting server located?

Many thanks
Steve

When you say it is not working on website - do you mean you’re getting error messages? Try to turn On error reporting for debugging purposes, and use mysql_error() function after you connect to a MySQL database, this will help you to locate the problem.

Hello

The error msg i get is…HTTP 500 internal server error

Here are the error logs for the script.

[size=8pt][Fri May 27 14:30:39 2011] [error] [client 91.125.47.42] PHP Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user ‘learn-bass.com’@‘localhost’ (using password: NO) in /home/sites/learn-bass.com/public_html/insert.php on line 16, referer: http://learn-bass.com/feedback.html
[Fri May 27 14:30:39 2011] [error] [client 91.125.47.42] PHP Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/sites/learn-bass.com/public_html/insert.php on line 16, referer: http://learn-bass.com/feedback.html
[Fri May 27 14:30:39 2011] [error] [client 91.125.47.42] PHP Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user ‘learn-bass.com’@‘localhost’ (using password: NO) in /home/sites/learn-bass.com/public_html/insert.php on line 17, referer: http://learn-bass.com/feedback.html
[Fri May 27 14:30:39 2011] [error] [client 91.125.47.42] PHP Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/sites/learn-bass.com/public_html/insert.php on line 17, referer: http://learn-bass.com/feedback.html
[Fri May 27 14:30:39 2011] [error] [client 91.125.47.42] PHP Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user ‘learn-bass.com’@‘localhost’ (using password: NO) in /home/sites/learn-bass.com/public_html/insert.php on line 18, referer: http://learn-bass.com/feedback.html
[Fri May 27 14:30:39 2011] [error] [client 91.125.47.42] PHP Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/sites/learn-bass.com/public_html/insert.php on line 18, referer: http://learn-bass.com/feedback.html
[Fri May 27 14:30:39 2011] [error] [client 91.125.47.42] PHP Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user ‘learn-bass.com’@‘localhost’ (using password: NO) in /home/sites/learn-bass.com/public_html/insert.php on line 19, referer: http://learn-bass.com/feedback.html
[Fri May 27 14:30:39 2011] [error] [client 91.125.47.42] PHP Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/sites/learn-bass.com/public_html/insert.php on line 19, referer: http://learn-bass.com/feedback.html
[Fri May 27 14:30:39 2011] [error] [client 91.125.47.42] PHP Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/sites/learn-bass.com/public_html/insert.php on line 28, referer: http://learn-bass.com/feedback.html
[Fri May 27 14:38:55 2011] [error] [client 91.125.47.42] PHP Parse error: syntax error, unexpected ‘=’ in /home/sites/learn-bass.com/public_html/insert.php on line 37, referer: http://learn-bass.com/feedback.html[/size]

Sponsor our Newsletter | Privacy Policy | Terms of Service