News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

ProDevTips.com:
MySQL replication in PHP - on the same machine
September 15, 2011 @ 09:48:14

ProDevTips.com has a new tutorial posted today sharing a database replication script they've put together to keep two databases in sync.

After reading up on MySQL replication for a bit I realized that it would go quicker to simply write something in PHP that would sync a subset of tables in one database to exact copies of the same tables in another. Note that the code/SQL [in the example] only works if you replicate from one database to another on the same machine since the main thing here are SQL queries that contain operations/look ups on two databases in the same query.

He includes the code to do the fetch on certain tables (based on a unique key), pushes them into an array and exports them back out into another table. There's also a modification included that makes it work on tables without an auto-increment column.

0 comments voice your opinion now!
mysql database replicate script tutorial


blog comments powered by Disqus

Similar Posts

PHP-GTK Blog: How to: PHP 5.3 with PHP-GTK and Cairo on Linux Mint 9

DevShed: Completing a Web Site Template using Inheritance in PHP 5

PHPro.org: Read Line From File (stream_get_line)

Evan Coury's Blog: Using Zend\Dbs TableGateway & HydratingResultSet to return rows as custom enties

SitePoint PHP Blog: Getting Started with PHP Extension Development via PHP-CPP


Community Events





Don't see your event here?
Let us know!


conference development tips api symfony community introduction release deployment interview threedevsandamaybe laravel zendserver code series framework language list podcast bugfix

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework