• ADADADADAD

    PHP中怎么利用XML备份Mysql数据库[ mysql数据库 ]

    mysql数据库 时间:2024-11-28 13:24:36

    作者:文/会员上传

    简介:

    请选择要备份的表格: $con=mysql_connect('localhost','root','xswlily'); $query="select * from $table "; //数据库查询 $result=mysql_db_quer

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。


    请选择要备份的表格:
    $con=mysql_connect('localhost','root','xswlily');
    $query="select * from $table ";
    //数据库查询
    $result=mysql_db_query("embed",$query,$con);
    $filestr="<"."?xml version="1.0" encoding="GB2312">";
    $filestr.="<".$table."s>";
    while ($row=mysql_fetch_array($result))
    //列出所有的记录
    {$filestr.="<".$table.">";
    $fields=mysql_list_fields("embed",$table,$con);
    $j=0;
    //$num_fields=mysql_field_name($fields,$j);
    //echo $num_fields;
    while ($j
    $num_fields=mysql_field_name($fields,$j);
    $filestr.="<".$num_fields.">";
    $filestr.=$row[$j];
    $filestr.="";
    $j++;}
    $filestr.="";
    }
    $filestr.="";
    echo $filestr;
    //以下是文件操作代码
    $filename=$table.".xml";
    $fp=fopen("$filename","w");
    fwrite($fp,$filestr);
    fclose($fp);
    Echo "数据表".$table."已经备份成功!";?>

    undefinedundefinedundefinedundefined

    PHP中怎么利用XML备份Mysql数据库.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: phpxmlmysql