Hi, just wondering if anyone can help me out with some problems i’m having with flash app trying to change a nodes value in an xml doc using php.
i’m new to this whole php thing, it’s just a simple voting application, people login then make a vote on one of the game titles that i’ve loaded from an xml doc, which means that in the xml array i’ve got “title” and “votes” for each game, i just want to add 1 to votes each time a game is chosen.
no matter what i do i can’t change what’s in the xml array, i’ve tried messing around with everything. i have installed php and view the flash movie in a browser from localhost.
this is what i’m running in flash, i’m not sure about the nodevalue = nodevalue +1, it seems to work in flash when i trace that node, but then when i run the php nothing changes in the xml
//run php doc to update xml
function phpCheck() {
rootGameData.childNodes;
game_xml.sendAndLoad("xmltest.php");
this.myReceiveXMLConnector.trigger();
}
//exporting xml information
function xmlExport() {
gameFound = false;
for (c=gameAmount; c>-1; c--) {
if (eval("gameHolder.checkBox"+c).selected == true) {
gameFound = true;
selectedGame = rootGameData.childNodes[c].childNodes[0].firstChild.nodeValue;
Numbbber = c;
rootGameData.childNodes[c].childNodes[1].firstChild.nodeValue = Number(rootGameData.childNodes[c].childNodes[1].firstChild.nodeValue)+1;
gotoAndStop("viewResults");
}
if (c == 0 && gameFound == false) {
trace("ERROR make sure chose a game");
}
}
}
this is what i’m running in php
<?php
$file = fopen("gameData.xml", "w+") or die("Can't open XML file");
$xmlString = $HTTP_RAW_POST_DATA;
if(!fwrite($file, $xmlString)){
print "Error writing to XML-file";
}
print $xmlString."
";
fclose($file);
?>