|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-10-05 13:17 UTC] sniper@php.net
[2000-10-05 21:18 UTC] bob at ark dot org
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Mon Jun 29 05:00:02 2026 UTC |
Assume you have 2 database in one mysql server: Database1 (contains table: table1) Database2 (contains table: table2) Try this: ----------------------- $conn_id1 = mysql_connect("localhost", "root", ""); $conn_id2 = mysql_connect("localhost", "root", ""); mysql_select_db("Database1", $conn_id1); mysql_select_db("Database2", $conn_id2); mysql_query("select * from table1", $conn_id1); mysql_query("select * from table2", $conn_id2); ----------------- the first query will fail, b/c the 'select_db' for conn_id1 was overwritten in the 'select_db' for conn_id2: it is looking for table1 in Database2. This hold true even inside objects, so it is difficult to create an object that accesses the database and use it in a script that accesses a different database.