(AS2) mySQL, PHP, convert to XML pass to Flash

** Hi

I am a bit of a newcomer who is trying to create a flash file that displays the top 5 highest rated songs (stored in a mySQL database) in dynamic text boxes. I have most of it done but am having problems using PHP to convert the results into XML to be passed to Flash.

I can successfully execute the mySQL query in phpmyAdmin:
[LEFT]SELECT Track, Artist, Votes FROM shows ORDER BY Votes DESC LIMIT 0, 5[/LEFT]
[LEFT]
[/LEFT]
[LEFT]I can also successfully load XML into flash, although i don’t know how to make a loop so the code is terrible (any help here would be great):[/LEFT]
[LEFT]
[/LEFT]
[LEFT]function loadXML(loaded) {[/LEFT]
[LEFT] if (loaded) {[/LEFT]
[LEFT] _root.playlist = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;[/LEFT]
[LEFT] _root.track = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;[/LEFT]
[LEFT] _root.votes = this.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;[/LEFT]
[LEFT] artist_txt.text = _root.playlist;[/LEFT]
[LEFT] track_txt.text = _root.track;[/LEFT]
[LEFT] votes_txt.text = _root.votes;[/LEFT]
[LEFT] [/LEFT]
[LEFT] _root.playlist = this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue;[/LEFT]
[LEFT] _root.track = this.firstChild.childNodes[1].childNodes[1].firstChild.nodeValue;[/LEFT]
[LEFT] _root.votes = this.firstChild.childNodes[1].childNodes[2].firstChild.nodeValue;[/LEFT]
[LEFT] artist2_txt.text = _root.playlist;[/LEFT]
[LEFT] track2_txt.text = _root.track;[/LEFT]
[LEFT] votes2_txt.text = _root.votes;[/LEFT]
[LEFT] [/LEFT]
[LEFT] etc etc … [/LEFT]
[LEFT] [/LEFT]
[LEFT] } else {[/LEFT]
[LEFT] content = “file not loaded!”;[/LEFT]
[LEFT] }[/LEFT]
[LEFT]}[/LEFT]
[LEFT]xmlData = new XML();[/LEFT]
[LEFT]xmlData.ignoreWhite = true;[/LEFT]
[LEFT]xmlData.onLoad = loadXML;[/LEFT]
[LEFT]xmlData.load(“top5_votes.xml”);[/LEFT]
[LEFT]
[/LEFT]
[LEFT]
[/LEFT]
[LEFT]
[/LEFT]
[LEFT]When I then try and change the file being loaded from an XML file to a PHP file it doesn’t work. I think the problem is with my PHP or making flash communicate with the PHP. This is my code:[/LEFT]
[LEFT]
[/LEFT]
[LEFT]<?php [/LEFT]
[LEFT]//connect to database[/LEFT]
[LEFT]include_once(“config.php”); [/LEFT]
[LEFT]
[/LEFT]
[LEFT]$result = mysql_query(“SELECT Track, Artist, Votes FROM shows ORDER BY Votes DESC LIMIT 0, 5”); [/LEFT]
[LEFT]
[/LEFT]
[LEFT]// Output an XML document [/LEFT]
[LEFT]echo ‘<?xml version=“1.0” encoding=“UTF-8”?>’; [/LEFT]
[LEFT]echo ‘<datapacket>’; [/LEFT]
[LEFT]while($row=mysql_fetch_array($result)){ [/LEFT]
[LEFT] $line = ‘<row Track="’.$row[Track].’" Artist="’.$row[Artist].’" Votes="’.$row[Votes].’"/>’; [/LEFT]
[LEFT] echo $line; [/LEFT]
[LEFT]} [/LEFT]
[LEFT]echo ‘</datapacket>’; [/LEFT]
[LEFT]?> [/LEFT]
[LEFT]
[/LEFT]
[LEFT]Can anyone tell me how I can make this work - i would really appreciate it. Thanks a lot guys![/LEFT]
**