0

Hello,

I need to select information from two different databases and join them into one web page. I am unsure how to go about doing this. I am not a PHP programmer, any help would be appreciated.

3
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by Shanti C
0

Not absolutely sure...

If the 2 databases are located on the same server (same "username", "password" and "localhost")...

I think you should try something like this:

$query="SELECT
first_database_name . first_table_name . optional_column_name ,
second_database_name . second_table_name . optional_column_name

FROM
first_database_name . first_table_name . optional_column_name

INNER JOIN
second_database_name . second_table_name . optional_column_name

etc...

0

On the same server just do this:

SELECT dbname.tablename.columnname,db2name.table2name.column2name FROM 
dbname.tablename, db2name.table2name;

(I think you get the idea)

As far as I know you can't select data across multiple servers.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.