Good Day,
This is going to be my first post in this forums. Im having a problem with taking the data from my mysql database and output the data in an xml file. The script is working but the output xml misses 1 row in my mysql data.
Here is my php script…Thanks
<?php
$fp = fopen("/xampp/htdocs/Playlist/$ipaddress.xml",‘w’);
$query = mysql_query("Select * FROM id_playlist WHERE id_playlist = ‘$ip_ID’ ",$db);
$row = mysql_fetch_array($query);
$xml_output .= "<?xml version=‘1.0’ encoding=‘UTF-8’?>
";
$xml_output .= "<playlist version=‘1’ xmlns=‘http://xspf.org/ns/0/’>
";
$xml_output .= “<trackList>”;
for($x = 0 ; $x < mysql_num_rows($query) ; $x++){
$row = mysql_fetch_assoc($query);
$xml_output .= " <track>
“;
$xml_output .= " <title>” . $row[‘title’] . "</title>
“;
$xml_output .= " <location>” . $row[‘path’] . "</location>
“;
$xml_output .= " <identifier>” . $row[‘id_playlist’] . "</identifier>
";
$xml_output .= " </track>
";
}
$xml_output .= “</trackList>”;
$xml_output .= “</playlist>”;
$write = fwrite($fp,$xml_output);
fclose($fp);
?>