title: Create php file to sync mysql data from some local server
body: <p>I develop a php application to get input from a technical support field(TSF) laptop (which is not always connected to internet) and from an online server on office.
  My idea is to create a php file to sync (send and receive) latest data between office PC(online) and TSF laptop(offline).</p>
  <p>The rule is that each TSF should sync every end of day to send that day report to office pc and get the latest data from office pc so they can be used even offline.</p>
  <p>The problem is I don't know how to create that php file.</p>
  <p>Here the structure of my mysql database :</p>
  <h3>Table <code>merchant</code> :</h3>
  <pre><code>id, name, address, phone, area, lastupdate
  </code></pre>
  <h3>Table <code>item</code> :</h3>
  <pre><code>id, merchid, sn, sku, code, lastupdate
  </code></pre>
  <h3>Table <code>visit</code> :</h3>
  <pre><code>id, date, merchid, itemid, act, result, lastupdate
  </code></pre>
  <p>TSF only can edit <code>merchant</code> and <code>item</code> table and add <code>visit</code> table, office PC can do anything...</p>
  <p>On each table i give <code>lastupdate</code> column so php sync script can compare which is the latest update...but i don't know how to compare it using php...can someone help me?</p>