Suppose i have three dbs on the same server.
DB #1:
host: localhost
user: root1
pass: pass1
Db: db1
DB #2:
host: localhost
user: root2
pass: pass2
Db: db2
DB #3:
host: localhost
user: root3
pass: pass3
Db: db3
You have noticed from above that i have three DBs on the same server but have different users.
Summary of DBs
DB #1 is use for main login page.
DB #2 has table called products2
products2
--------
id
sku
name
...
DB #3 has table called products3
products3
---------
id
sku
name
....
What i want to do is:
I want perform query in DB #2’s products2 table & DB #3’s products3 so that i can display the products with common sku.
Hope my problem is clear.
My Question is:
1> is it possible to make a single query for two database? If yes how?
2> if above is not possible then,
Would it be effective to make separate fetching from two dbs as an arrays.
And manipulating that array for the required results?
If you have three different users then it would require three connections, so not possible. But if you give one user access to all dbs then that will be fine, just don’t use select_db, and reference db.table.field as you are doing.