0

Ok, I'm really really stuck with this. I've tried everything to my knowledge to fix it, but I just can't. So please, can anyone here help me with this error:

Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'host-ip' (4) in /home/ashley/public_html/pw/inc/config.php on line 7

This is my PHP:

$dbconn = mysql_connect($dbhost, $dbuser, $dbpass);

I've tried everything, gone through 20 pages of Google, nothing. If anyone here can help me fix this, I will be eternally grateful.

2
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by xapher19
0

Hi xapher19,

have you tried echoing the variables just before you try to connect, to make sure they are what you expect them to be?

echo "Host: " . $dbhost . "<br />User: " . $dbuser . "<br />Password: " . $dbpass;
0

Yes, I've tried all of that. The thing is. This was working perfect 24 hours ago. I come back, and in my logs, at 4PM yesterday, the connection was severed and I haven't found the problem yet.

0

Have you tried contacting your webhost to see if they have had any problems (or updated MySQL)?

0

All of the server are owned by us. Our database is a on our game server, the website on our web server. The database works fine on localhost, and our game is not affected. However, our web host is having problems connecting. Myself and my colleague have both successfully connected to the MySQL server through Navicat. This is what's confusing me so much.

0

hmm, if no code or settings, like the users permissions, have been changed I'm not sure what the problem could be.

I don't think the problem is PHP related. The error message you are getting is just saying the script is trying to connect but can't.

Maybe try reposting in the MySQL forum to see if anyone there has any ideas?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.