A little modifications in "Output mySQL data as XML with PHP" tutorial

Hi to everyone,

I started my first steps in flash php and sql, i found this tutorial
“Output mySQL data as XML with PHP” very handy.
It helped me a lot to understand one way i can load from sql easy as an XML the values into flash.
what i want is to make a small modification in flash and in php so that i can send a variable to trigger the php-XML dynamic tree and load it in flash.

for e.x. THIS IS THE WORKING WAY OF THE TUTORIALS PHP

<?php

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

$host = "localhost";
$user = "root";
$pass = "";
$database = "test";

$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host.");
mysql_select_db($database, $linkID) or die("Could not find database.");

$query = "SELECT * FROM blog ORDER BY date DESC";
$resultID = mysql_query($query, $linkID) or die("Data not found.");

$xml_output = "<?xml version=\"1.0\"?>
";
$xml_output .= "<entries>
";

for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
    $row = mysql_fetch_assoc($resultID);
    $xml_output .= "	<entry>
";
    $xml_output .= "		<date>" . $row['date'] . "</date>
";
        // Escaping illegal characters
        $row['text'] = str_replace("&", "&", $row['text']);
        $row['text'] = str_replace("<", "<", $row['text']);
        $row['text'] = str_replace(">", "&gt;", $row['text']);
        $row['text'] = str_replace("\"", "&quot;", $row['text']);
    $xml_output .= "		<text>" . $row['text'] . "</text>
";
    $xml_output .= "	</entry>
";
}

$xml_output .= "</entries>";

echo $xml_output;

?> 

WHAT I WANT TO DO IS THIS…

 <?php

$action = $_POST['action'];

if($action == "test"){
       test();
}

function test(){

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

$host = "localhost";
$user = "root";
$pass = "";
$database = "test";

$linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host.");
mysql_select_db($database, $linkID) or die("Could not find database.");

$query = "SELECT * FROM blog ORDER BY date DESC";
$resultID = mysql_query($query, $linkID) or die("Data not found.");

$xml_output = "<?xml version=\"1.0\"?>
";
$xml_output .= "<entries>
";

for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
    $row = mysql_fetch_assoc($resultID);
    $xml_output .= "	<entry>
";
    $xml_output .= "		<date>" . $row['date'] . "</date>
";
        // Escaping illegal characters
        $row['text'] = str_replace("&", "&", $row['text']);
        $row['text'] = str_replace("<", "<", $row['text']);
        $row['text'] = str_replace(">", "&gt;", $row['text']);
        $row['text'] = str_replace("\"", "&quot;", $row['text']);
    $xml_output .= "		<text>" . $row['text'] . "</text>
";
    $xml_output .= "	</entry>
";
}

$xml_output .= "</entries>";

echo $xml_output;
}

?> 

I am trying to create the dynamic XML tree as you see by sending a variable from flash …
When the “action” variable will be ‘test’ the appropiate function will run and i will have my XML into the PHP working fine i test it so far…

The main problem is in flash.

How can i load the same PHP as an XML by using also the sendAndLoad variables to send the “action” variable and trigger the php to XML tree and get back the XML tree? ? ? ?

Does anyone tried or know a way?
I am not to good in php and flash and i am new also …

Any help or guidness will be appreciated
Thanx in advance