Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

multiple db's classes ptrs? help?

Codes here !

Moderators: macek, egami, gesf

Postby quelle » Mon Mar 24, 2003 10:25 pm

I've never done it before, but mysql_query() takes an optional second parameter which is a resource identifier. You could use this param to specify which DB you are connecting to. Eg.

// get link identifiers
$dbh1 = mysql_connect....
$dbh2 = mysql_connect...

// use these link IDs when selecting your DBs
mysql_select_db("DB1", $dbh1);
mysql_select_db("DB2", $dbh2);

// and pass link ID to each query so query uses the correct DB
$result1 = mysql_query("some query", $dbh1);
$result2 = mysql_query("some query", $dbh2);

You said you were using classes so you could set the link ID in your constructor and use it in all of your queries.

Hope this helps!
quelle
New php-forum User
New php-forum User
 
Posts: 8
Joined: Tue Aug 20, 2002 11:57 am

Return to mySQL & php coding

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.