Forum Moderators: coopster

Message Too Old, No Replies

create xml files with php command from mysql

xml, php, and mysql

         

paladogan

12:28 am on Jan 31, 2003 (gmt 0)

10+ Year Member



Hi, I am a new comer
I'm still confuse how to create xml file from php which take the information from mysql database (by taking title and link). For example, i want to feed news from my website. By giving people link of my rss/xml file they can view our headline news, and if they clicked the link on the title new window would open

anybody can help me? please give an example or full code

andreasfriedrich

7:11 am on Jan 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld [webmasterworld.com] paladogan.

Be sure to read Marcia`s WebmasterWorld Welcome and Guide to the Basics [webmasterworld.com] post.

There is no fundamental difference between using php to write HTML or XML. In fact when you are being XHTML compliant you are using PHP to write XML documents.

<?php 
echo <<<END
<?xml version="1.0" encoding="UTF-8"?>
<root>
<element>content</element>
</root>
END;
?>

The above script will send a XML document when it gets requested.

So all of the usual tutorials and information about retrieving data from a database still apply to your situation as well. All you need to do is retrieve the data from the db and write it out in a way conforming to the rss format.

Andreas

paladogan

1:52 am on Feb 2, 2003 (gmt 0)

10+ Year Member



okay...now I see
thank you very much