+ 2

how to fetch records from multiple database using php?

I need to fetch the records from 2 different databases using join or any other methods. I have created different connection to connect with two databases but I don't know how I can execute the query and which connection should I used to fetch the records. Any suggestions?

14th Sep 2018, 8:55 AM
Mayur Shedage
Mayur Shedage - avatar
3 Respostas
+ 1
@SQL Guy - I have to different database server with two different connections. Then how can I fetch the records using single SQL query. Which connection should I used to ?
14th Sep 2018, 9:05 AM
Mayur Shedage
Mayur Shedage - avatar
0
I guess you will have to make multiple queries. Select the records you wish from one database, select the records you wish from the other database, and then join both queries in a third query. Depending what kind of databases you use you may need ODBC or JDBC drivers.
14th Sep 2018, 9:11 AM
SQL Guy
- 1
Try if it works when you add the names of your databases like this SELECT FROM DBName.TableName
14th Sep 2018, 8:58 AM
SQL Guy