Get the App
SLTechnology News&Howtos  ›  Database  › 

How to use XML to back up Mysql Database in PHP

Shulou Source: shulou.com Published: 2022-05-31 19:18:20 10月03日 Update

This article introduces how to use XML to back up Mysql database in PHP, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Please select the form to back up:

$con=mysql_connect ('localhost','root','xswlily')

$query= "select * from $table"

/ / Database query

$result=mysql_db_query ("embed", $query,$con)

$filestr= ""

$filestr.= ""

While ($row=mysql_fetch_array ($result))

/ / list all records

{$filestr.= ""

$fields=mysql_list_fields ("embed", $table,$con)

$jambo0

/ / $num_fields=mysql_field_name ($fields,$j)

/ / echo $num_fields

While ($j

$num_fields=mysql_field_name ($fields,$j)

$filestr.= ""

$filestr.=$row [$j]

$filestr.= ""

$jamboree;}

$filestr.= ""

}

$filestr.= ""

Echo $filestr

/ / the following is the file operation code

$filename=$table. ".xml"

$fp=fopen ("$filename", "w")

Fwrite ($fp,$filestr)

Fclose ($fp)

Echo "Datasheet". $table. "backup succeeded!" ;? >

Undefinedundefinedundefinedundefined

On how to use XML backup Mysql database in PHP to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Backup data database content more help good success code interest guy partner datasheet file article knowledge article table reference query Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Docker Apple Huawei Shulou Information