This code is modified from Uchome code because it is handled in order to solve the efficiency of uchome. This thinking is actually a long time, but has not been to do, I believe that some people have the same idea, if there is a similar, that really want to make relevant suggestions.
The encapsulation is simpler, increases the interface extension of the read-only database connection, does not use a read-only database, and does not affect the original code. To continue to improve the future.
For convenience, try setting up a Google project:
http://code.google.com/p/mysql-rw-php/
Hope to bring help to a friend in need.
PHP implementation of MySQL read and write separation
Main Features:
Simple Read and write separation
One master database, you can add more read-only databases
Read-Write separation but don't worry about some features not supported
Disadvantage: Connecting two databases at the same time
English sucks, write a few words.
PHP code for MySQL Read/write split
Feature
Simply RW split
One master,can add more slaves
Support all MySQL feature
Link to the master and slave in the same time