query from 2 database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
luciferr
Forum Newbie
Posts: 1
Joined: Thu Apr 23, 2009 8:01 am

query from 2 database

Post by luciferr »

Hey. sorry about for my poor english.
I will try to exp. my problem.
I have to something for my site but have no any idea how to do it.
I have two mysql database on my server and they have same tables but for two different site.

db1:
host: localhost
dbname: back
user: back
Pass: 123zxc

db2:
host: localhost
dbname: kunder
user:back
pass: 123zxc

on the database 1 have I a table as name "ns_tracker_ip" and to columns as "ID" (integer) and "IP" (varchar)
I have same table and columns on database 2 too. And i have an another table on database 2 as name is lat say "ns_taracker_sales" and this table have columns like "abc", "xyz" and "123".

I want make a query with php like will get the "IP" numbers on database 2 and compare them with the "IP" s on database 1 if its exist, will it do a list with that ip's on database 2 + info from "ns_tracker_sales" tables with all the columns.


i know how can i make a connection to two different database on same time but i m really confused how I can make the query.

Thanx for any help.
Post Reply