# \[xml+php+as\] cant retrieve row $ID in Flash

**URL:** <https://forum.kirupa.com/t/xml-php-as-cant-retrieve-row-id-in-flash/188397>\
**Category:** Uncategorized\
**Created:** [May 7, 2006, 11:18am UTC](https://forum.kirupa.com/t/xml-php-as-cant-retrieve-row-id-in-flash/188397 "2006-05-07T11:18:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bitterpill](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bitterpill/32/1935_2.png) [@bitterpill](https://forum.kirupa.com/u/bitterpill)\
**Post date:** [May 7, 2006, 11:18am UTC](https://forum.kirupa.com/t/xml-php-as-cant-retrieve-row-id-in-flash/188397/1 "2006-05-07T11:18:58Z")

</div>

Hi… this is my PHP code

> \<?php  
> header(“Content-type: text/xml”);

$host = “localhost”;  
$user = “root”;  
$pass = “”;  
$database = “samdb”;

$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 songlist WHERE genre=‘Emo’ ORDER BY ID ASC limit 25”;  
$resultID = mysql\_query($query,$linkID) or die (“Data not found”);

$xml\_output = "\<?xml version ="1.0"?\>  
";  
$xml\_output = "\<songlist\>  
";  
$count = mysql\_num\_rows($resultID);  
for ($x = 0; $x \< $count; $x++){  
$row = mysql\_fetch\_assoc($resultID);  
$xml\_output .= " \<songlist\>  
“;  
$xml\_output .= " \<artist\>” . $row[‘artist’] . "\</artist\>  
“;  
$xml\_output .= " \<id\>” . $row[‘ID’] . "\</id\>  
“;  
$xml\_output .= " \<title\>” . $row[‘title’] . "\</title\>  
";  
$xml\_output .= " \</songlist\>  
";  
}  
$xml\_output.= “\</songlist\>”;

echo $xml\_output;  
?\>

And if you go to the URL : [http://snazzyfm.no-ip.info/shout/songlist\_retrieve.php](http://snazzyfm.no-ip.info/shout/songlist_retrieve.php)

The results is :

> onglist\>

- \<songlist\>  
\<artist\>Starting Line\</artist\>  
\<id\>416\</id\>  
\<title\>The Best Of Me (Acoustic)\</title\>  
\</songlist\>

- \<songlist\>  
\<artist\>Brand New\</artist\>  
\<id\>509\</id\>  
\<title\>Am I Wrong\</title\>  
\</songlist\>
- \<songlist\>  
\<artist\>Brand New\</artist\>  
\<id\>510\</id\>  
\<title\>Moshi Moshi\</title\>  
\</songlist\>
- \<songlist\>  
\<artist\>Further Seems Forever\</artist\>  
\<id\>566\</id\>  
\<title\>Monechetti\</title\>  
\</songlist\>

And in Flash, here’s what I did to display all the Artist and Title in sequence.

> 

// retrieve songlist

function loadXML2(loaded) {  
if (loaded) {  
songlist.htmlText = “”;  
var myXML = xmlData.firstChild.childNodes;  
\_global.artistA = ;  
\_global.titleA = ;  
for (i=0; i\<myXML.length; i++) {  
\_global.artistA\* = this.firstChild.childNodes\*.childNodes[0].firstChild.nodeValue;  
\_global.titleA\* = this.firstChild.childNodes\*.firstChild.nextSibling.nextSibling.firstChild.nodeValue;  
songlist.htmlText += “\<b\>”+artistA\*+“\</b\> " + titleA\*+”\<br\>";  
}  
}  
}

// load songlist  
function reloadXML2() {  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML2;  
xmlData.load(“[http://snazzyfm.no-ip.info/shout/songlist\_retrieve.php](http://snazzyfm.no-ip.info/shout/songlist_retrieve.php)”);  
}

loop songlist  
reloadXML2();  
setInterval( reloadXML2, 1000 );

and all is working fine but right now i’d also like to display results of ID in Flash, but this is what i did and it didnt seem to work

> 

```
    _global.IDA = []; // added this

```

\_global.IDA\* = this.firstChild.childNodes\*.firstChild.nextSibling.nextSibling.firstChild.nodeValue;

// and this  
songlist.htmlText += “\<b\>”+artistA\*+“\</b\> " + titleA\*+IDA\*+”\<br\>";

Or is there something i should know about ID (which is the Primary Key) that cannot be displayed in Flash this way? Please advise someone, I’m stumped!
