Help PHP write XML file The Word table data read only one data, what reason
PHP based on the primary table type traversal from the table for data generation MXL file data only displays one specific following
Include ("admin.php");
if (File_exists (". /xml/list.xml "))
{
Unlink (".. /xml/list.xml ");//exist first delete
}
Create DOCTYPE Header
$dom = new DOMDocument ("1.0", "Utf-8");
Create root element for image
$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 field
Save Tree to File
$dom->save (". /xml/list.xml ");//save to the specified directory
Header ("location:content_show.php");
?>
The result of PHP output is
Tian Ao Online Games Guild
Wwww
Rich Games Guild
Tick.. /xml/music/Sword is like a dream. mp3
Phoenix legend. /xml/music/Sword is like a dream. mp3
The scattered People's Paradise Guild
The sword is like a dream. /xml/music/Sword is like a dream. mp3
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.