Jump to content

Using PHP to generate XML file


LanceT

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.