Re: Two DB's - One Script
| From: | (Richard Lynch) | Date: | Fri, 16 Jun 2000 00:56:21 +0000 |
| Subject: | Re: Two DB's - One Script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-2019@lists.php.net to get a copy of this message | ||
In article <H0000aad057ab5ee@MHS>, M.vanderMerwe@expro.shell.co.uk wrote:
> Is there a way I can connect to two DB's in one script?
Yes.
I'm assuming you're using MySQL since that's the one that lets you leave
off the connection in all the functions, and it just uses the last one you
opened.
Look at the docs for mysql_query() for instance, and you'll see an
optional link_identifier:
$connection1 = mysql_connect('host1', ...);
$connection2 = mysql_connect('host2', ...);
$result1 = mysql_query("select count(*) from blah", $connection1);
$result2 = mysql_query("select count(*) from blah", $connection2);
--
Richard Lynch | If this was worth $$$ to you, buy a CD
US Customer Support Director | from one of the artists listed here:
Zend Technologies USA | http://www.L-I-E.com/artists.htm
http://www.zend.com | (this has nothing to do with Zend,
duh!)