+ 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?
3 Answers
+ 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 ?
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.
- 1
Try if it works when you add the names of your databases like this
SELECT FROM DBName.TableName