You will use the mysql_select_db() function. It sets the currently active database.  
You will call this function each time you wish to change which database is being used 
prior to issuing a query. 

You need to open only one connection as long as the databases are on the same server.  
If you are using multiple servers, you will require a connection to each with unique 
resource link_identifiers.  Then you will have to include the desired resource link_id 
in each call to mysql_select_db().  There is no need to close and re-open connections 
between each use.


On Sat, 29 Mar 2003 19:09:28 -0800 (PST), Lonnie Cumberland wrote:

>Hello All,
>I am new to using PHP with MySQL and was wondering if anyone had a simple
>example of how to have multiple active connections to two MySQL databases in a
>single script?
>I will have to access two different databases but am not sure how to keep the
>active connections and make different queries to each one without having to
>open one database, make a query, close it, then open the other database and 
>make it's query.
>This should be possible I think.
>Any help would be greatly appreciated,
>Lonnie Cumberland
>Do you Yahoo!?
>Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
>PHP Database Mailing List (
>To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to