Variables in Dynamic Text Boxes

Hi Guys!

Newbie here! Hoping you can help me out though - I must say Kirupa has been SO helpful in my journey learning AS3 and getting my projects off the ground, so I must say thank you to everyone first of all. :smiley:

So, here is my conundrum:

I have a PHP file which is correctly pulling records from a SQL database. What I need to do is place each new record into a new text box.

I understand that I need to assign a variable to each record as it comes through the PHP file and that Flash needs to know which variable to assign to which text box. So, in that respect I have added a counter to the PHP script (it is performing correctly)

Essentially I was hoping you guys could assist me with the ActionScript on how to pull the correct variables. Below is the code I have, PHP first:

<?PHP

$link = mysql_connect(“localhost:3306”, “root”, “”);
mysql_select_db(“test”);

$result = mysql_query(‘SELECT Brand, Style, Sample FROM stock’);

$count=0;

while($row=mysql_fetch_array($result)){

echo "$row[Brand]";
echo "$row[Style]

";
echo “$row[Sample]”;

$count++;

}

And the the ActionScript:

var myLoader:URLLoader = new URLLoader();
//the data will come as URL-encoded variables
myLoader.dataFormat = URLLoaderDataFormat.TEXT;
//Load using an URLRequest, even being local
myLoader.load(new URLRequest(“http://localhost/autumnleaf/new6.php”));
//onLoad handler listener
myLoader.addEventListener(Event.COMPLETE, onDataLoad);
//Error handling
myLoader.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
myLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
//Could be an error or just a message
myLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatus);
//add a listener for the complete event
function onDataLoad(evt:Event){
//trace(evt.target.data);
list1.text = unescape(evt.target.data.)
}
//error callbacks
function onIOError(evt:IOErrorEvent){
trace("IOError: "+evt.text)
}
function onHTTPStatus(evt:HTTPStatusEvent){
trace("HTTPStatus: "+evt.status)
}
function onSecurityError(evt:SecurityErrorEvent){
trace("SecurityError: "+evt.text)
}

At the moment using the above script Flash is putting all the SQL data into one text box. I have previously tried to alter the evt.target.data to correctly assign the variables, but this has failed.

Any help is most appreciated!

Vicky