I am having troubles loading xml data (via php/mysql) into an animated swf. The first time it loads it works, but everytime i run the animation the result is “undefined”. I am attempting to load a registered user’s first name from mysql through php. I am defining this data by $_SESSION[‘username’] in the php, which the creates the xml. Any hints on this matter would be greatly appreciated.
PHP:
<?php
session_start();
$link = mysql_connect(“XXXXXXX”, “XXXXXXX”, “XXXXXXX”);
mysql_select_db(“XXXXXXX”);
$query = “SELECT * FROM users WHERE username = '”. $_SESSION[‘username’] ."’";
$results = mysql_query($query);
echo "<?xml version=“1.0” encoding=“ISO-8959-1”?>
";
echo "<FirstNames>
";
while($line = mysql_fetch_assoc($results)) {
echo “<item>” . $line[“FirstName”] . "</item>
";
}
echo "</FirstNames>
";
?>
Flash AS:
my_xml = new XML();
my_xml.load(“http://www.XXXXXX.php?nocache=” + Math.random());
my_xml.onLoad = my_function;
my_xml.ignoreWhite = true;
function my_function() {
dynamictextbox_instancename = my_xml.firstChild.childNodes[0].firstChild.nodeValue;
}
Thanks again!
Mike