LifeKills Posted November 8, 2009 Share Posted November 8, 2009 I have a flash vote counter I'm working on. it stores the vote totals in an XML document which gets inputted directly into flash which then increments the vote and uses a php script to change and save the data. my problem is I'm a complete noob to PHP, so I'm not even sure that this code is proper syntax or that my algorithm is even feasible: savedata.php: <?php $adam=$_POST[Adam]; $rob=$_POST[Rob]; $page=$_POST[currurl]; $dom = new DOMDocument(); $dom->load('votes.xml'); $xpath = new DOMXpath($dom); $adamtags = $xpath->query('Adam'); $robtags = $xpath->query('Rob'); $adamtags[$page]->nodeValue = $adam; $robtags[$page]->nodeValue = $rob; $dom->save('votes.xml'); ?> here's my ActionScript3 code that interacts with the PHP: var phpFile:URLRequest = new URLRequest("savedata.php"); var variables:URLVariables = new URLVariables(); variables.Adam = adamcount; variables.Rob = robcount; variables.currurl = pagenum; phpFile.data = variables; phpFile.method = URLRequestMethod.POST; the XML file is formatted like so: <?xml version="1.0" encoding="utf-8"?> <Votes> <Adam>4</Adam> <Rob>7</Rob> <Adam>0</Adam> <Rob>0</Rob> </Votes> please forgive my complete noobness Link to comment https://forums.phpfreaks.com/topic/180738-php-changing-an-xml-file/ Share on other sites More sharing options...
Thauwa Posted November 8, 2009 Share Posted November 8, 2009 why don't you use MySql? Link to comment https://forums.phpfreaks.com/topic/180738-php-changing-an-xml-file/#findComment-953567 Share on other sites More sharing options...
LifeKills Posted November 8, 2009 Author Share Posted November 8, 2009 because I don't know a single thing about mysql or using mysql with flash, but I know how to use php and xml with flash. I know what I'm doing is possible, so I'd like to do it this way if I can find a simple solution. I can learn mysql once I get my site published, but I don't want to do that until I get this vote counter working either way I'd have to use php, and I know more about xml than I do about mysql unless you know of a tutorial that explains it nicely Link to comment https://forums.phpfreaks.com/topic/180738-php-changing-an-xml-file/#findComment-953579 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.