Mysql database backup from PHP file
by Prabakaran[ Edit ] 2012-08-01 14:57:18
<?php
///*** This file will help you to take mysql database back-up using PHP – Rakshit Patel **////
include("mysql-connection.php");
mysql_select_db("testing"); // select database
$bkfile = 'backup/back-up.sql';
$query = "SELECT * INTO OUTFILE '$bkfile' FROM 'test_table'";
$result = mysql_query($query);
mysql_query($sql) or die('Error, backup data failed');
$query = 'LOAD DATA INFILE '$bkfile' INTO TABLE 'test_table2'";
$result = mysql_query($query);
mysql_query($sql) or die('Error, load data failed');
include("mysql-connection-close.php");
?>