I have followed a tutorial on kirupa “http://www.kirupa.com/web/mysql_xml_php.htm” and i have got the database working and the php working and spitting out the xml. here is the code for that:
<?php
$host = "localhost";
$user = "arctosde_damz";
$pass = "pass";
$database = "arctosde_cms";
$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 news ORDER BY date ASC";
$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(">", ">", $row['text']);
$row['text'] = str_replace("\"", """, $row['text']);
$xml_output .= " <text>" . $row['text'] . "</text>
";
$xml_output .= " </entry>
";
}
$xml_output .= "</entries>";
echo $xml_output;
?>
I am just wanting to know how I can code it so that it writes the xml to a file so that I can then read that file in flash? I guess that would probally have something to do with the “output” part. or maybe there is actually a way of just using flash to connect to the php (above) with out having to write xhtml to a file?
thanx alot appriciate the help:}