SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
Thread: Querying Multiple Databases
-
Feb 3, 2005, 17:13 #1
- Join Date
- Apr 2003
- Location
- Rockhampton, Australia
- Posts
- 699
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Querying Multiple Databases
Greetings!
I currently have a separate MySQL database for each client, as much of their stuff is different, however the table that logs their site statistics is the same in each db. As part of that reporting, I also have a table that matches IP addresses to Country, which I have to reproduce in each database.
So is it possible to have the IP-to-Country table in one database, and then query two databases at the same time? Or is my only option to keep reproducing the IP-to-Country table in each db?
Thanks!
-
Feb 3, 2005, 19:48 #2
- Join Date
- Apr 2002
- Location
- Melbourne
- Posts
- 707
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
What I do is I have a default db to hold all the common information from all the clients. Then in the code, I would connect to the relevant db's using mysql_select_db() to query the client's information. Once I got the client's information, I stored what was needed in variables and then went back to the default db (using mysql_select_db again). I don't think you can query multiple databases at the same time.
Websites: DH Softwares|Arcade Online|Bizarre Facts|Fun Arcade
More sites: Gin Recipes|High Score Games|Cool Free Online Games
Really Funny Clips at ReallyFunnyClips.com
-
Feb 3, 2005, 20:23 #3
- Join Date
- Apr 2003
- Location
- Rockhampton, Australia
- Posts
- 699
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks dragonhawk, how do you go retrieving large amounts of data from the client databases? If you're retrieving thousands of rows from the client's database before switching back, large amounts of info can be stored in variables okay?
-
Feb 3, 2005, 20:31 #4
- Join Date
- Apr 2002
- Location
- Melbourne
- Posts
- 707
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yea, should have no problem storing in variables. You can use arrays to store all the information if you need to organise it in a single variable or you can store each value into different variables. Depending on what you're storing, you might use an array or individual variables.
For eg, if you are querying multiple client's at a time, then arrays would be better. A new array for a new client. If only a single client, then you can use individual variables. Though I personally would go for an array in any caseWebsites: DH Softwares|Arcade Online|Bizarre Facts|Fun Arcade
More sites: Gin Recipes|High Score Games|Cool Free Online Games
Really Funny Clips at ReallyFunnyClips.com
-
Feb 3, 2005, 20:39 #5
- Join Date
- Apr 2003
- Location
- Rockhampton, Australia
- Posts
- 699
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Cheers dragonhawk - I'll give that a try.
Thanks!
Bookmarks