title: How can i synchronize two database tables with PHP?
body: <p>I need to use PHP to copy data from one MySQL database to another. </p>
  
  <p>I can build and array of all the values to go into the other database but first I want to make sure the database has the correct fields before inserting. </p>
  
  <p>For example say I am going to be copying data from tableA to tableB. </p>
  
  <p>I can set up tableB to look just like tableA but in the future I may add columns to tableA and forget to add them to tableB, then my PHP script will try to insert data into a column that doesn't exist in tableB and it will fail. </p>
  
  <p>So what I want to do is compare tableA to tableB and any columns that tableA has that tableB doesn't have add them to tableB.</p>
  
  <p>Can anyone tell me how to do this?</p>