Home >Backend Development >PHP Tutorial >PHP backup database code (1/10)_PHP tutorial

PHP backup database code (1/10)_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:04:52874browse

php backup database code This is a code for php mysql database backup and restore backup. You can back up the database of your website at will and restore it at the same time. This program generates a .sql database file. You can also import it with other tools. , convenient, all SQL database backup statements are generated, so the compatibility is good.

//php tutorial backup database tutorial code

This is a php mysql tutorial database backup and restoration code. You can back up the database of your website at will and restore it at the same time. This program generates a .sql database file. You can also use other tools. Importing is convenient and all SQL database backup statements are generated, so the compatibility is good.
*/
?>
import.php

/**
* Database backup program
*
* @author:黄乐
* @version:1.0
* @lastupdate:2010-7-19
*
​*/

include("config/config.php");
include("includes/dbbackup.class.php");
include("includes/msg.class.php");
$dbbackup = new dbbackup($dbhost, $dbuser, $dbpwd, $dbname);
$msg = new msg();
$bakfile = $dbbackup->get_backup(); //Get the backup file
if($_get['fn']){
if($dbbackup->import($_get['fn'])){ //Import data
$str = "Congratulations
The backup data has been successfully imported!"; //Prompt message
$msg->show_msg($str,'import.php','export.php'); //Prompt for successful import
}
}
//Delete backup file
if($_post['sub']){
echo $dbbackup->del($_post['choice'])? $msg->show_msg("Congratulations
The backup file has been successfully deleted!",'import.php','export.php' ): $msg->show_msg("Deletion failed!",'import.php','import.php');
}
?>

1 2 3 4 5 6 7 8 9 10

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630827.htmlTechArticlephp backup database code This is a php mysql database backup and restore backup code, you can do whatever you want The database of the website can be backed up and restored at the same time. This program generates...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn