LanceT Posted March 4, 2007 Share Posted March 4, 2007 How do you use PHP to generate an XML file? I need to use PHP to grab some variables from my database and then insert them into my XML file for a dynamic flash playlist that changes with each user. Currently my XML file looks like this <?xml version="1.0" encoding="UTF-8"?> <songs> <song url="url1" artist="artistname1" track="001" /> <song url="url2" artist="artistname2" track="003" /> <song url="url3" artist="artistname3" track="004" /> </songs> I want it so that each variable (artist, url, track) can be pulled from my mySQL database to generate this XML file. How do I do it? Link to comment https://forums.phpfreaks.com/topic/41061-using-php-to-generate-xml-file/ Share on other sites More sharing options...
dsaba Posted March 4, 2007 Share Posted March 4, 2007 you can query your mysql database to find every aspect that you need in the xml playlist then you can make variables for all of those with the proper xml syntax/code then make a new entry into your db of all that xml, and call it xml playlist for that specific user maybe diff. playlist by diff. userids then on the userid page you can simple query and echo that xml data wherever you need it Link to comment https://forums.phpfreaks.com/topic/41061-using-php-to-generate-xml-file/#findComment-198873 Share on other sites More sharing options...
LanceT Posted March 4, 2007 Author Share Posted March 4, 2007 so are u saying its possible that something like page.php?view=usersxmlplaylist can be an XML file? Is the .xml extension not necessary? Link to comment https://forums.phpfreaks.com/topic/41061-using-php-to-generate-xml-file/#findComment-198874 Share on other sites More sharing options...
dsaba Posted March 4, 2007 Share Posted March 4, 2007 here's what I'm saying first of all you need to tell me where this xml data is being used if it is simply being displayed, if it is being used in a flash mp3 player where?? i don't know how to generate auto xml pages with php but i know how to use mysql databases to query and display data when you need it mysql can hold html, xml, whatever you put in there and display it as long as its within php so if xml data is already in your mysql database you can display it in a .php page, simply by querying Link to comment https://forums.phpfreaks.com/topic/41061-using-php-to-generate-xml-file/#findComment-198876 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.