Mysql database backup from PHP file

by Prabakaran 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");
?>
921
like
0
dislike
0
mail
flag

You must LOGIN to add comments