Ask PHP to write data into the XML file. The word table reads only one piece of data. Why does PHP traverse the data from the table based on the type in the master table? & nbsp; generate mxl & nbsp; only one & nbsp; file data is displayed as follows & lt ;? Phpinclude ("admin. php"); if (file_exists ("../xml/list. x ask PHP to write data into an XML file. The word table reads only one piece of data. why?
PHP traverses the data from the table based on the type of the master table. only one message is displayed for the mxl file generated for the data as follows:
Include ("admin. php ");
If (file_exists ("../xml/list. xml "))
{
Unlink ("../xml/list. xml"); // if it exists, delete it first.
}
// Create doctype header
$ Dom = new DOMDocument ("1.0", "UTF-8 ");
// Create root element
$ Root = $ dom-> createElement ("list ");
$ Dom-> appendChild ($ root );
$ Dom-> formatOutput = true;
$ SqlClass = "select music_class from dj_class"; // read data from the database
$ ResClass = mysql_query ($ sqlClass );
While ($ rowClass = mysql_fetch_array ($ resClass ))
{
$ Music_class = $ rowClass ['Music _ class']; // read a field
// Save tree to file
$ Dom-> save ("../xml/list. xml"); // save it to the specified directory
// Header ("location: content_show.php ");
?>
Php output:
Tiao Online Game Association
Wwww
Haomen webgame Association
Tick ../xml/music/Swordsman
Legend of Phoenix ../xml/music/Swordsman
Slab
A sword is like a dream ../xml/music/sword is like a dream
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.