# Php-xml-flash?

**URL:** https://forum.kirupa.com/t/php-xml-flash/195771
**Category:** Uncategorized
**Created:** [August 3, 2006, 12:16am UTC](https://forum.kirupa.com/t/php-xml-flash/195771 "2006-08-03T00:16:15Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Daimz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/daimz/32/2383_2.png) [@Daimz](https://forum.kirupa.com/u/Daimz)
#### Post date: [August 3, 2006, 12:16am UTC](https://forum.kirupa.com/t/php-xml-flash/195771/1 "2006-08-03T00:16:15Z")

</div>

I have followed a tutorial on kirupa “[http://www.kirupa.com/web/mysql\_xml\_php.htm](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
 <?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("\"", "&quot;", $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:}
