faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

10 of 107 people (9%) answered Yes
Recently 2 of 10 people (20%) answered Yes


How can I use PHP to create XML documents with data from a database e.g Sybase, Mysql. Does it exsist any tutorials on this ? Thanks.

Feb 22nd, 2008 03:18
dman, Ian Williams, Richard kirkcaldy, urge overkill, Arild Sæle, http://www.ttnr.org

1. I assume you know XML
2. You need to have a dtd created for the doc(a design issue)
3. Read data from the tables
4. Keep adding data and your created tags(as per dtd)to a file using 
file operation functions( there are many)
5. Save it as .xml
I guess this should at least give you an idea about how to get going. 
The technical and specific details,you have to sort out. Sorry no idea 
about tuorials. cheers!
Ian W says: There's a basic tutorial here:
It just iterates through a recordset, adding "<" and "/>" etc in the 
right places. I think it's probably better to use the PHP XML DOM 
extension, but I'm a bit of a newbie too!