Jump to content

Archived

This topic is now archived and is closed to further replies.

dragonusthei

connecting to 2 mysql databases problem?

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.