Re: multiple connections to MySQL in a single script example

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Doug


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!
>http://platinum.yahoo.com
>
>-- 
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>



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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux