Hi all,
I am having a little problem with my connection. I have a sepearate db connection page which I include at the top of all pages and this is the content:
session_start();
// Connect to database 1
$remotehostname = "remotehost";
$remoteusername = "root";
$remotedatasource = "mydatabase1";
$remotepassword = "";
$remoteport = 3306;
$_SESSION['S_REMOTE_DB'] = mysql_connect($remotehostname . ":" . $remoteport, $remoteusername, $remotepassword) or die(mysql_error());
mysql_select_db($remotedatasource, $_SESSION['S_REMOTE_DB']);
// Connect to database 2
$localhostname = "localhost";
$localusername = "root";
$localdatasource = "mydatabase2";
$localpassword = "";
$localport = 3306;
$_SESSION['S_LOCAL_DB'] = mysql_connect($localhostname . ":" . $localport, $localusername, $localpassword) or die(mysql_error());
mysql_select_db($localdatasource, $_SESSION['S_LOCAL_DB']);
When selecting data from my database I choose which database to connect to like such:
$dataresult = mysql_query($sqlquery, $_SESSION['S_REMOTE_DB']);
OR
$dataresult = mysql_query($sqlquery, $_SESSION['S_LOCAL_DB'])
For some reason it is failing and only works if I remove one of the connection types from my DB header page.
Any suggestion on how to get them both working?
K