Basic PHP and XML Question

I was just wondering if it would be possible to create the following xml sheet through php with the “value” amount being loaded from a mysql database.

Many Thanks.

<?xml version="1.0"?>
<graphs width="50">
	<graph name="Liberal Democrat" value="50" color="0xFDC13E"/>
	<graph name="Conservative" value="80" color="0x25B7E2"/>
	<graph name="Labour" value="10" color="0xE7473F"/>
</graphs>

The general purpose of PHP is to produce HTML pages.
XML is very similar markup language.
99% of php scripts doing job of creating text pages with data pulled from database.

So, it is possible, and even more - it is what for PHP were invented and designated.

fair comment. Out of interest what would the code be because most the tutorials I have found have made xml which looks like this


<xml>
<a>
<b></b>
</a>
<a>
<b></b>
</a>
</xml>

etc whereas the code I was using was laying it out slightly differently

I can’t see much difference beteen two codes.
You can print whatever you wish and with any format you want.

Both code snippets are working PHP codes. You can put it in the php file and just run it.
Save for the first line of the first snippet, which can cause an error under some circumstances.
So, it could be

<?php echo '<?xml version="1.0"?>' ?>
<graphs width="50">
	<graph name="Liberal Democrat" value="50" color="0xFDC13E"/>
	<graph name="Conservative" value="80" color="0x25B7E2"/>
	<graph name="Labour" value="10" color="0xE7473F"/>
</graphs>

if I do it that way is it still possible to load the xml into flash, as it ends with .php still which seems to through up an error message in flash

What kind of message?
Filename extension means a little more than nothing.
You’ll need proper HTTP header more likely

I will attach what I’m trying to do its easier to explain.
Basically I’m trying to draw a graph in flash which draws in the data from the xml sheet, but, I’m trying to have the values for the different political parties votes come from a mysql table that I have set up.

There are 4 columns, id, conservative, labour, and liberaldemocrat, then in just one row each of the parties has a different value which gets updated via an UPDATE command through php which I have got working.

So basically I just need to create the graph.xml page through php and have the flash document load it correctly, so it draws the graph.