String Comparison How To while using Flash, PHP and MySQL

I have an artist gallery (done with Actionscript 2.0) that needs an addition. Right now, users can click a “PURCHASE” button for a drawing and then proceed to a form page that is a request for purchase. I would like the “PURCHASE” button for that item to display “SOLD” (and be disabled as a button) from that point on for anyone else accessing the website. So, I figure using PHP/MySQL is the only way to deal with this.
Each drawing in the gallery has a unique item number assigned to it as an attribute contained in an XML doc with all the other gallery information.

The XML Attribute looks like this:

item_number=“12122003”

I’m trying to figure out how I can do a string compare of the current item number with the various item number strings that would be written to the MySQL database table. I could use PHP to create an XML doc that contains just the item number strings.

The PHP query of the MySQL database table could return the results as XML like this:


<?xml version="1.0"?>
<artwork>
     <item>12122003</item>
     <item>01101993</item>
     <item>01101994</item>
     <item>01111994</item>
     <item>01121993</item>
</artwork>

And Flash/Actionscript could read the PHP created XML doc like this:


var xmlPHP:XML = new XML();
xmlPHP.ignoreWhite = true;

xmlPHP.onLoad = function() {

    var nodes = this.firstChild.childNodes;
    for (i = 0; i < nodes.length; i++) {
        theList.addItem(nodes*.firstChild.nodeValue,i);
    }
};
xmlPHP.load("http://www.domain.com/sold.php");

Now if I want to find out if the PHP XML output contains the string “12122003”, what would be the best way to do this kind of string comparison?