I've been trying to figure this out for a few days now. I have 4 databases that I need to connect to. I am trying to alternate between the connections but it wont let me. It always takes the last connection.
$link = mysql_connect("localhost","root","");
mysql_select_db("front",$link);
$link2 = mysql_connect("mysite.com","user","2012");
mysql_select_db("db1",$link2);
$link3 = mysql_connect("mysite.com","user","2012");
mysql_select_db("appsdb",$link3);
$link4 = mysql_connect("mysite.com","user","2012", TRUE);
mysql_select_db("storagedb",$link4);
what do I need to do?
This works but takes too long
$link = mysql_connect("localhost","root","");
mysql_select_db("front",$link);
$link2 = mysql_connect("mysite.com","user","2012",true);
mysql_select_db("db1",$link2);
$link3 = mysql_connect("mysite.com","user","2012",true);
mysql_select_db("appsdb",$link3);
$link4 = mysql_connect("mysite.com","user","2012", true);
mysql_select_db("storagedb",$link4);
Is it possible to separate the connections altogether but still use $link, $link2, $link3, $link4 inside the queries? I dont think its efficient to keep all connections open.