Jump to content

Recommended Posts

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

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  :P

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.