Recommendation for a PHP class to sync database: sync database beetween local machine and server

Recommend this page to a friend!
  All requests RSS feed  >  Recommendation for a PHP class to syn...  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

Recommendation for a PHP class to sync database

A request is featured when there is no good recommended package on the site when it is posted. Edit

Picture of serio by serio - 6 years ago (2014-11-04)

sync database beetween local machine and server

This request is clear and relevant.
This request is not clear or is not relevant.

+4

I want to synchronize a database between my nightrain PHP application running SQLite and the same application on the server running MySQL.

  • 2 Clarification requests
  • 2. Picture of Jacob Fogg by Jacob Fogg - 6 years ago (2014-11-17) Reply

    Just finished writing a class to do just this. Once it's approved, I'll recommend it here. You simply instantiate two PDO connections to your databases then call a method to sync each table, along with options about how you want to sync them. Including the use of a where clause which will allow you, for instance if you had a timestamp, to sync records after the time of your last sync operation. Again, as soon as my class is approved, I'll add it here.

    • 1. Picture of Manuel Lemos by Manuel Lemos - 6 years ago (2014-11-04) Reply

      I only find packages for synchronizing MySQL databases.

      But you said you run the same application on development with SQLite and in production with MySQL.

      Are you using an abstraction layer to make the application run equally with SQLite and MySQL?

      Ask clarification

      1 Recommendation

      PHP Database Sync: Synchronize tables of different databases with PDO

      This recommendation solves the problem.
      This recommendation does not solve the problem.

      +3

      Picture of Jacob Fogg by Jacob Fogg package author package author Reputation 70 - 6 years ago (2014-11-18) Comment

      This class should work well for you. It would be very easy to write a script that iterated over all of your tables to copy the entire database.

      • 2 Comments
      • 1. Picture of Manuel Lemos by Manuel Lemos - 6 years ago (2014-11-18) Reply

        Awesome!

        It seems to synchronize one table at a time. I wonder if it would be possible to somehow synchronize all tables at once.

      • 2. Picture of Jacob Fogg by Jacob Fogg package author package author - 6 years ago (2014-12-01) in reply to comment 1 by Manuel Lemos Reply

        Sure, that would just require one additional small script. Perhaps I could create an Ajax script that will iterate through the tables to prevent long running script errors.


      Recommend package
      : 
      : 
      For more information send a message to info at phpclasses dot org.