Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'sql4.bravehost.
Hi,
I am recieving an error when trying to connect to my SQL database using PHP (it is connecting externally) I am quite sure there is nothing wrong with the PHP script because i tried it with Java to and i get the same problem. I recieve the following error:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'sql4.bravehost.com' (10060) in C:Documents and SettingsJamesDesktopxampplitehtdocstext.php on line 5
Connection Failure to Database
I can use phpMyAdmin to read the tables etc... But i cannot connect externally. Does bravenet block external connections?
Here is my PHP script by the way.
$dbuser="Username";
$dbpass="Password";
$dbname="highscores-750328"; //the name of the database
$chandle = mysql_connect("sql4.bravehost.com", $dbuser, $dbpass)
or die("Connection Failure to Database");
echo "Connected to database server ";
mysql_select_db($dbname, $chandle) or die ($dbname . " Database not found." . $dbuser);
echo "Database " . $database . " is selected";
mysql_close($chandle);
?>
I have deleted my username and password for obvious reasons.
Re: Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'sql4.braveh
EDIT: I have just tried uploading the file to my bravenet host and it connects fine. Does this mean it only allows connections from my site? I need it to connect from my Java application as well =S