title: php copy/synchronize/duplicate database with content
body: <p>I'm trying to manage a way of edit content on test_db and when I'm happy with results use a button to update the backup_db, just like you get in blogger per example. When you're happy, you choose the option to publish and your edits go online.</p>
  
  <p>Having no idea on how to, I Googled a while and made this php script.</p>
  
  <pre><code>&lt;?php
  $connection = mysql_connect("localhost", "user", "pass") or die("Error!: " . mysql_error()." : ".$connection);
  
  mysql_select_db("test_db") or die (mysql_error()." : ".$connection);
  
  $sql = "mysqldump -h [localhost] -u [user] - p[pass] test_db | mysql -h [localhost] -u [user] -p[pass] backup_db";
  
  system($sql);
  
  mysql_close($connection);
  
  ?&gt;
  </code></pre>
  
  <p>it doesn't work. How can I do this?</p>