can someone help me please. I have my php scripts on one server (server A) with one host and my MYSQL database hosted on another server (server B)with another different host. now i'm attempting to connect to a MYSQL database on server B via a php script from server A. Here is the PHP script : <? $siteemail='admin@serverA.com'; $subject="SQL Database Down"; $message="SQL Database Down\nError Number="; $headers = 'From: ' . "\r\n" . 'Reply-To: ' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $link=mysql_connect("mysql1.serverB.net:3306","ServerB_user","PWD"); $error = mysql_errno(); if (!$link) { echo "Mysql connect error = $error"; $message .= $error; mail($siteemail,$subject,$message,$headers); exit; } else { $db_selected = mysql_select_db ("Server_DB"); $error = mysql_errno(); if (!$db_selected) { echo "Mysql select db error = $error"; $message .= $error; mail($siteemail,$subject,$message,$headers); exit; } } ?> it reaches : $link=mysql_connect("mysql1.serverB.net:3306","ServerB_user","PWD"); and tries to connect and exits with this being printed on the screen : Mysql connect error = 2003 It doesnt reach the mysql_select_db command. What am i doing wrong ? Why cant i connect ? thanks in advance.
You cannot connect to a MySql database hosted elsewhere, disregard you own both accounts. Most hosting services have disable that option due to abuse and security breaches, so you can only connect to your localhost, not a remote database, unless you get one from those services that offer such facility
mystique thanks for that... can you give me some hosters that allow remote access to their mysql databases ? tia
Sure Tia, this is a good site that only asks for a link back in your main page to give your remote access to your mysql database hosted with them: www.free-mysql.bizhostnet.com