RE: [PHP] Connecting to multiple DB's

2002-04-01 Thread Rick Emery

Both connects are "active".

you specify which link when you select the database:
mysql_select_db("database_name", $db1);  mysql_select_db("database_name",
$db2);

-Original Message-
From: James Taylor [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 12:48 PM
To: PHP List
Subject: [PHP] Connecting to multiple DB's


I host a few sites, and on usually each site will have it's own MySQL 
database in the background.  I've decided that I want to link one site 
to another, and need to connect to more than one database at a time.
I've found that when I try to connect to 2 or more, even if I assign the 
other database to another variable
(ie .

$db1 = @mysql_connect($dbhost, $dbuser, $dbpass);
$db2 = @mysql_connect($dbhost2, $dbuser, $dbpass);

)

, the last connect called is the only one that is active.

Any work arounds to this?  I've been having to do it where I connect to 
one when needed, then connect to the other, etc.  I'm thinking there has 
to be a better way to do this.

Also, what is the function to kill a connection to a db?  Thanks!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Connecting to multiple DB's

2002-04-01 Thread Patrick Hartnett

Not sure about the multiple connections side, but to kill a connection:

mysql_close($link);

where $link is your connection variable/string

hope this helps.

-Patrick


>From: James Taylor <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: PHP List <[EMAIL PROTECTED]>
>Subject: [PHP] Connecting to multiple DB's
>Date: Mon, 01 Apr 2002 10:47:45 -0800
>
>I host a few sites, and on usually each site will have it's own MySQL
>database in the background.  I've decided that I want to link one site
>to another, and need to connect to more than one database at a time.
>I've found that when I try to connect to 2 or more, even if I assign the
>other database to another variable
>(ie .
>
>$db1 = @mysql_connect($dbhost, $dbuser, $dbpass);
>$db2 = @mysql_connect($dbhost2, $dbuser, $dbpass);
>
>)
>
>, the last connect called is the only one that is active.
>
>Any work arounds to this?  I've been having to do it where I connect to
>one when needed, then connect to the other, etc.  I'm thinking there has
>to be a better way to do this.
>
>Also, what is the function to kill a connection to a db?  Thanks!
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>




_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Connecting to multiple DB's

2002-04-01 Thread James Taylor

I host a few sites, and on usually each site will have it's own MySQL 
database in the background.  I've decided that I want to link one site 
to another, and need to connect to more than one database at a time.
I've found that when I try to connect to 2 or more, even if I assign the 
other database to another variable
(ie .

$db1 = @mysql_connect($dbhost, $dbuser, $dbpass);
$db2 = @mysql_connect($dbhost2, $dbuser, $dbpass);

)

, the last connect called is the only one that is active.

Any work arounds to this?  I've been having to do it where I connect to 
one when needed, then connect to the other, etc.  I'm thinking there has 
to be a better way to do this.

Also, what is the function to kill a connection to a db?  Thanks!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php