Table(s) data sync PHP+MYSQL

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
varwik
Forum Newbie
Posts: 3
Joined: Wed Mar 17, 2010 11:43 am

Table(s) data sync PHP+MYSQL

Post by varwik »

Hi All,
I have two data bases , one is resides in production site and which is mysql , I want to syncronize this data base table data(only data ) to a data base which is not used in live environment and use for report module(DBR). The data sync should be realtime and its only changed data should be propagete to the DBR database. DDL functions not required to carring out in the DBR data base.
I am new to PHP but have worked with mysql , i am looking forward some help for a php script.

Thanks a lot any help welcome,
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Table(s) data sync PHP+MYSQL

Post by Christopher »

Find out what database extension you have available and then check the manual. It is really just SQL once you know which library to call.

Also, you might want to look into MySQL replication instead.
(#10850)
varwik
Forum Newbie
Posts: 3
Joined: Wed Mar 17, 2010 11:43 am

Re: Table(s) data sync PHP+MYSQL

Post by varwik »

Thanks Christopher for quick response,
It is all mysql i have to start, i am looking for som php code help to identify data differences in given tables and insert/update/delete to second database tables,
Mysql replication is not posible here the first data base is not possible to change the configurations to support replication.


Thanks a lot
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Table(s) data sync PHP+MYSQL

Post by Christopher »

To compare the data in two different databases you need to SELECT the data and use PHP to compare the fields. You may want to have your application always write to both databases to they both have the same values.
(#10850)
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Table(s) data sync PHP+MYSQL

Post by Benjamin »

If you require two different databases on separate platforms to remain in sync (in real-time) you'll need to ensure that they are modified together. You can accomplish this through the use of XML requests, with parsers on each side.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Table(s) data sync PHP+MYSQL

Post by Weirdan »

Not exactly in PHP, but does what you want: http://www.maatkit.org/doc/mk-table-sync.html
varwik
Forum Newbie
Posts: 3
Joined: Wed Mar 17, 2010 11:43 am

Re: Table(s) data sync PHP+MYSQL

Post by varwik »

Weirdan,benjamin,Christopher,Thanks for your valuable posts , i am looking for a solution like maatkit.
i am looking it and believe that i can find a solution to it.

Thanks a lot
Post Reply