没有合适的资源?快使用搜索试试~ 我知道了~
用php程序如何备份mysql数据库数据。
资源推荐
资源详情
资源评论
<?php
include"../config/auth.php";
include"../config/public_include.php";
include"../config/config.php";
include"../config/db_function.php";
include"../config/functions.inc.php";
$conn= Connect_DB($DB_VARS_ARRAY);
$sql="SELECT VERSION() AS sqlversion";//sql版本
$rec=mysql_query($sql);
$row=mysql_fetch_array($rec);
$sqlversion=$row['sqlversion'];
$seldate=$_POST['seldate'];///////接收要备份的表名
if($seldate!=""){
$tablename=explode(',',$seldate);
$retstr = "#\n# VeryCMS Backup\n# Version:".$sqlversion."\n# Time: ".date('Y-m-d H:i')."\n# Type: \n# PHPWind: http://www.phpwind.net\n# --------------------------------------------------------\n\n\n";
for($i=0;$i<count($tablename)-1;$i++){
$table=$tablename[$i];
$sql="show create table $table";/////显示表结构
//echo $sql;
$rec=mysql_query($sql);
$row=mysql_fetch_array($rec);
$retstr.=$row[1].";"."\n";////表结构内容
$sq="select * from $table";
$re=mysql_query($sq);
$ins="";
while($ro=mysql_fetch_array($re)){
$ins="insert into $table set ";
for($k=0;$k<mysql_num_fields($re);$k++){
$ins.=mysql_field_name($re,$k)."='".$ro[$k].";";
include"../config/auth.php";
include"../config/public_include.php";
include"../config/config.php";
include"../config/db_function.php";
include"../config/functions.inc.php";
$conn= Connect_DB($DB_VARS_ARRAY);
$sql="SELECT VERSION() AS sqlversion";//sql版本
$rec=mysql_query($sql);
$row=mysql_fetch_array($rec);
$sqlversion=$row['sqlversion'];
$seldate=$_POST['seldate'];///////接收要备份的表名
if($seldate!=""){
$tablename=explode(',',$seldate);
$retstr = "#\n# VeryCMS Backup\n# Version:".$sqlversion."\n# Time: ".date('Y-m-d H:i')."\n# Type: \n# PHPWind: http://www.phpwind.net\n# --------------------------------------------------------\n\n\n";
for($i=0;$i<count($tablename)-1;$i++){
$table=$tablename[$i];
$sql="show create table $table";/////显示表结构
//echo $sql;
$rec=mysql_query($sql);
$row=mysql_fetch_array($rec);
$retstr.=$row[1].";"."\n";////表结构内容
$sq="select * from $table";
$re=mysql_query($sq);
$ins="";
while($ro=mysql_fetch_array($re)){
$ins="insert into $table set ";
for($k=0;$k<mysql_num_fields($re);$k++){
$ins.=mysql_field_name($re,$k)."='".$ro[$k].";";
资源评论
laogongshilei
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功