tags:

views:

70

answers:

3

My fellow friend is building site in flash and he uses xml files to access data in Flash. I want to build editable cms so that client can edit stuff.

Now i don't' have any experience with XML. I know php html mysql very well.

SO how can i change those already build xml files using mysql and php.

ANy help??

A: 

You probably should look at the PEAR XML Serializer Package. It makes it easy to convert a multi-dimensional array into XML.

Here's a decent tutorial: http://articles.sitepoint.com/article/xml-php-pear-xml_serializer

AvatarKava
A: 

Output the XML using PHP in exactly the same way the example XML file does and then put this at the top of your code:

header('Content-type: text/xml');

To create the XML file from the database just ouput the data the way you normally would adding XML tags in the right place. Eg:

<news>
<?
    while($item = mysql_fetch_array($data)){
    ?>
    <item>
        <url><?=$item['url']; ?></url>
        <title><?=$item['title']; ?></title>
    </item>
    }
?>
</news>

If you need more assistance, provide the XML file that was given to you with the flash file as a reference.

Sam152
sorry guys i have no experience with xml. so if i already have xml file in some where. and i want that data from data field in mysql inside that xml. what are steps to perform? example first i need ti code the from in php to change data in mysql. i can do that. but how can xml file get that chnaged data? do i have to write xml file using php in that folder or something
Mirage
@Mirage, you seem to think that xml is a template that will get filled with data. It is not (well, not in general case), xml is already data (with hierarchical structure). You need to define how will your relational data map to the xml file.
Unreason
@Unreason , thanks buddy i think u exactly got what i was thinking but now i got it.
Mirage
+2  A: 

Maybe going through

http://library.creativecow.net/articles/brimelow_lee/php_mysql/video-tutorial.php

will clear things for you.

Though, use it only to understand the concepts of XML and how it relates to mysql, php and swf. For real work look at libraries that deal with XML such as serializer mentioned in AvatarKava's answer.

Unreason
that video cleared all my doubts
Mirage