Hi,
I have run into a very, very wierd problem and I hope someone here has some sort of idea how/why this is happening.
I have a site hosted with one company (server 1) that has to connect to my mySQL sever (server 2). When I run my connection script (shown below) I can connect to the database without any problems, but it will not allow me to select a database. I have no idea why this would be happening, could it be a php install problem? I have double checked my script and am absolutely sure that the syntax, hostname, db name etc are correct.
Can someone she some light on this?
Here is the script:
<?php
define(MYSQL_HOST, "host");
define(MYSQL_USER, "user");
define(MYSQL_PASS, "pass");
// connect to db
$db = mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS);
// if connection fails, die gracefully.
if(!$db)
die("<font size=2 face=verdana>There was an error connecting to the mySQL database.<br><br>If this problem persists, please contact your system administrator.</font>");
if(mysql_select_db("dbname")) {
echo "select db worked<br><br>";
} else {
echo "select did not work<br><br>";
}
if(!mysql_query("SELECT * FROM gm_counter")) {
echo mysql_error() . ' ' . mysql_errno();
}
?>
Thanks,
Damien