title: PHP script for exporting a single table to SQL file
body: <p>I want to export a single table into an SQL file for backup every day using cron-job.<br>
  I've looked around for some scripts bust most were not so user-friendly.</p>
  
  <p>I've seen this: <a href="http://help.1and1.com/hosting-c37630/linux-c85098/php-c37728/importing-and-exporting-mysql-databases-using-php-a595887.html" rel="nofollow">http://help.1and1.com/hosting-c37630/linux-c85098/php-c37728/importing-and-exporting-mysql-databases-using-php-a595887.html</a></p>
  
  <p>But it exports the whole DB (which weighs about 10GBs), I need to export a single 16mb table.</p>
  
  <p>The preferred method is for it to look like a normal sql file (like the ones Phpmyadmin exports), something like this: </p>
  
  <pre><code> CREATE TABLE IF NOT EXISTS `parts` (
    `flag` char(1) NOT NULL DEFAULT '',
    `comp` int(10) NOT NULL DEFAULT '0',
    `name` varchar(255) NOT NULL DEFAULT '',
    `rname` varchar(255) NOT NULL DEFAULT '',
    `hname` varchar(255) NOT NULL DEFAULT '',
  </code></pre>