Jump to content


Photo

connecting to 2 mysql databases problem?


  • Please log in to reply
1 reply to this topic

#1 dragonusthei

dragonusthei
  • Members
  • PipPipPip
  • Advanced Member
  • 46 posts

Posted 18 October 2006 - 10:20 AM

Hi how would i make this work?

$db1 = mysql_connect();

$db1_select = mysql_select_db();

$db2 = mysql_connect();

$db2_select = mysql_select_db();

//code goes here

#2 phil88

phil88
  • Members
  • PipPipPip
  • Advanced Member
  • 111 posts

Posted 18 October 2006 - 11:29 AM

Depends what you  mean by work?


With mysql_select_db(), you can chuck it 2 parameters, the database and the connection to use. So with your code, you could do;

$db1 = mysql_connect("Host", "username", "password");
$db1_select = mysql_select_db("DatabaseName", $db1);

$db2 = mysql_connect("Host", "username", "password");
$db2_select = mysql_select_db("DatabaseName", $db2);

Obviously replacing host, username, password and databasename with the actual data.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users