How to use XML to back up Mysql Database in PHP
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.