I would like to be able to back up parts of my database by providing a form / link which will give the admin the choice to download the file in a sql format (like in IPB).
I have researched this a little; and been succesful in being able to backup the database into a location on the server where I define, but I'm not sure how I can change it into being download-able (obviously if it is downloaded I don't want it on the server anymore...).
This is what I have so far (I have commented it):
include 'conf_global.php'; // File with database settings
$tableName = 'a_table'; // The table which the admin has chosen to backup (Static for exemplory reasons)
$backupFile = 'backup/DATE_TABLE.sql'; // Where the sql is places
$query = "SELECT * INTO OUTFILE '$backupFile' FROM $tableName"; // Back up table into file
$result = mysql_query($query); // Query it
echo 'Database Backed Up'; // If succesful
echo 'Database NOT Backed Up'; // If not..
Can someone help me please?