SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
Thread: query between 2 databases
-
Dec 27, 2006, 10:16 #1
- Join Date
- Dec 2006
- Posts
- 120
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
query between 2 databases
hi,i would like to make a query between 2 databases
eg.
PHP Code:select memberID from databaseA.table1
$id=$row['memberID']
select address from databseB.table2 where memberID='".$id."'
thank you!
-
Dec 27, 2006, 10:44 #2
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
Code:select two.address from databaseA.table1 as one inner join databaseB.table2 as two on two.memberID = one.memberID
-
Dec 27, 2006, 11:04 #3
- Join Date
- Dec 2006
- Posts
- 120
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
Dec 27, 2006, 11:20 #4
- Join Date
- Feb 2004
- Location
- Tampa, FL (US)
- Posts
- 9,854
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
you can connect to either database. it's not possible to connect to both at the same time. because you explicitly tell mysql which database to use, there is no need to specify both in the connection.
-
Dec 28, 2006, 09:03 #5
- Join Date
- Dec 2006
- Posts
- 120
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Bookmarks