title: trying to backup mysql database using php
body: <p>I got this code from this site: <a href="http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/using-php-to-backup-mysql-databases.aspx" rel="nofollow noreferrer">http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/using-php-to-backup-mysql-databases.aspx</a></p>
  
  <p>But I'm just a beginner so I don't know what  the config.php and opendb.php suppose to mean. Do I have to create those 2 files in order for this code to work?
  If yes, then how do I create it, it isn't included in the site how to create it.</p>
  
  <pre><code>&lt;?php
  include 'config.php';
  include 'opendb.php';
  
  $tableName  = 'mypet';
  $backupFile = 'backup/mypet.sql';
  $query      = "SELECT * INTO OUTFILE '$backupFile' FROM $tableName";
  $result = mysql_query($query);
  
  include 'closedb.php';
  ?&gt; 
  </code></pre>
  
  <p>can I just include these lines on the top code so that I will not be putting the include 'opendb.php' anymore:</p>
  
  <pre><code>$con = mysql_connect("localhost","root","");
  if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
  
  mysql_select_db("Hospital", $con);
  </code></pre>