# Xml data undefined in flash

**URL:** https://forum.kirupa.com/t/xml-data-undefined-in-flash/146568
**Category:** Uncategorized
**Created:** [May 2, 2005, 4:01pm UTC](https://forum.kirupa.com/t/xml-data-undefined-in-flash/146568 "2005-05-02T16:01:45Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![phiroh](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@phiroh](https://forum.kirupa.com/u/phiroh)
#### Post date: [May 2, 2005, 4:01pm UTC](https://forum.kirupa.com/t/xml-data-undefined-in-flash/146568/1 "2005-05-02T16:01:45Z")

</div>

Hi everyone,

I am trying to load a xml file which was created by a php-file into flash.  
the problem is, it works when I open it in a browser but not in flash\>export or in a standalone player. When I load a .xml file its okay, but not the .php

Any ideas?

AS:

```auto
function loadXML(loaded) {
	if (loaded) {
		_root.inventor = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
		_root.comments = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
		date_txt.text = _root.inventor;
		comment_txt.text = _root.comments;
	} else {
		comment_txt.text = "loading";
	}
	
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("pathto.php");

```

PHP:

```php
 <?php
//header("Content-type: text/xml"); --> otherwise wouldn't work at all

require ( 'config.php' );

$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 cons_test 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'] . "
";
		// Escaping illegal characters
		$row['comment'] = str_replace("&", "&", $row['comment']);
		$row['comment'] = str_replace("<", "<", $row['comment']);
		$row['comment'] = str_replace(">", ">", $row['comment']);
		$row['comment'] = str_replace("\"", """, $row['comment']);
	$xml_output .= " <text>" . $row['comment'] . "
";
	$xml_output .= "	</entry>
";
}

$xml_output .= "</entries>";

echo $xml_output;

?> 

```
