fill listbox from mysql data
hi everyone. heres my question: i want to fill a listbox with data from a MySql table. the code ive gotten working is for static data from an xml file. here it is:
var options:XML = new XML();
options.ignoreWhitespace = true;
var loader:URLLoader = new URLLoader(new URLRequest("fillRegions.xml"));
loader.addEventListener("complete",function(event){
options = new XML(loader.data);
var myRegion = options.region;
for(var i in myRegion ){;
select.addItem({label:myRegion .name});
};
});
var select = new List();
regionList.addChild(select);
where the xml file looks like this:
<?xml version="1.0" ?> <tblregions> <region><name>Africa</name></region> <region><name>Asia</name></region> <region><name>The Caribbean</name></region> <region><name>Central America and Mexico</name></region> <region><name>Eastern Europe and Central Asia</name></region> <region><name>North Africa</name></region> <region><name>The Middle East</name></region> <region><name>The Pacific Islands</name></region> <region><name>South America</name></region> </tblregions>
now id like to make this dynamic by pulling the data from a Mysql table. i use a php file to pull the data and echo it as an xml output. here that is:
<?php
error_reporting(0);
session_start();
include 'db_connect.php';
$result = mysql_query("Select * from tblregions");
echo ('<?xml version="1.0" ?>');
echo ("</br>");
echo ("<root");
echo ("</br>");
echo ("<tblregions>");
echo ("</br>");
while($rows = mysql_fetch_assoc($result)){
echo ("<region>");
echo ("</br>");
echo ("<name>". $rows['RegionName'] . "</name>\n");
echo ("</br>");
echo ("</region>");
echo ("</br>");
}
echo ("</br>");
echo ("</tblregions>");
echo ("</root");
?>
this creates an echod file that looks just like the above xml example. so, how do i change my original AS3 code to pull data from this php file rather then the xml file? thanks for your help
jason