Comparing the records from two similar tables in diff DBs

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
tomex1
Forum Commoner
Posts: 26
Joined: Sun Aug 16, 2009 11:34 am

Comparing the records from two similar tables in diff DBs

Post by tomex1 »

Hi all,
I am trying to compare two similar tables from separate databases to see what field has changed in Database A and update that row in B as well display it to the user on my php page.
I would really appreciate any information you can give me.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Comparing the records from two similar tables in diff DBs

Post by John Cartwright »

Assuming your master database will be the only one being written to, I would approach this at the database level considering synchronizing multiple databases at the application level can be tricky. Take a look at mysql replication.
tomex1
Forum Commoner
Posts: 26
Joined: Sun Aug 16, 2009 11:34 am

Re: Comparing the records from two similar tables in diff DBs

Post by tomex1 »

Hi John,
I absolutely agree with you. The problem is, the only access I have got to the master database is to just select. That's the reason why I am approaching it from the app level. I have been trying my best with comparing the arrays but I can't just get my head round it. Please have you got any suggestions?

Thanks a lot
Post Reply