Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

Flash PHP XML HELP!

This is a discussion on Flash PHP XML HELP! within the PHP | mySQL | Flash CS3 forums, part of the Flash CS3 eng category; I'm working on a Flash AS3.0 project. I have Flash posting variables out to a PHP script and ...


Go Back   Forum Flash CS3 Flash CS4 > English Forums > Flash CS3 eng > PHP | mySQL | Flash CS3

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-01-08, 20:14
Junior Member
 
Join Date: Dec 2007
Location: Oklahoma City OK USA
Posts: 4
Rep Power: 0
jWeis is on a distinguished road
Flash PHP XML HELP!

I'm working on a Flash AS3.0 project. I have Flash posting variables out to a PHP script and the handling the return, the problem is with the PHP script.

I'm trying to open an XML file, locate a node with XPATH, get its "vote" attribute value, add one to the value and reset it to the new value.
My script:
$name = $_POST[contestantName];
$doc = new DOMDocument();
$doc->load("contestants.xml");
// Locate contestant by name
$xpath = new DOMXpath($doc);
$query = "//*[.='$name']";
$nameEtal = $xpath->($query);
// Get current # of votes, add 1, set attribute to new value
$votes = $nameEtal->getAttribute('votes');
$votesPlus = ($votes + 1);
$nameEtal->setAttribute("votes", $votesPlus);
// Save
$doc->save("contestants.xml")
// Talk Back

echo 'answer=ok';
?>


THANKS!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)  
Old 11-01-08, 08:01
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,486
Rep Power: 6
Flep is on a distinguished road
Re: Flash PHP XML HELP!

Hi jWeis and welcome

Try to this echo:
PHP Code:
$answer="ok";
echo 
"answer=".$answer
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 11-01-08, 20:11
Junior Member
 
Join Date: Dec 2007
Location: Oklahoma City OK USA
Posts: 4
Rep Power: 0
jWeis is on a distinguished road
Re: Flash PHP XML HELP!

Hi Flep! I love the site and your Utilities and resources are great!

Thanks for the suggestion. I tried it but I still can't get the script to edit the xml.

Here's an examlpe element from the xml file I'm working with..
HTML Code:
<contestants>
   <contestantInfo>  <eliminated>false</eliminated>   <image>assets/contestantBLANK.png</image>   <name votes="0">Test Contestant1</name>   <hometown>AnyTown.IN</hometown>   <info>1 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Mauris orci massa, accumsan ut, commodo ut, lobortis id, massa. Nulla gravida, dui a feugiat consequat, magna tortor pharetra ipsum, vel volutpat sem ipsum vel orci. Maecenas aliquet leo non ante. Duis est nunc, lobortis tristique, euismod et, ullamcorper vel, magna. In adipiscing rutrum dui. Nunc tristique sollicitudin erat. Curabitur eu elit eu ante porta luctus. Aenean dictum mi ac dui. Donec id tortor. Nulla consequat ipsum ut dui. Proin viverra, lacus at vulputate imperdiet, urna lorem mollis felis, eget iaculis orci sem ut justo. Sed eget ligula. Phasellus cursus pharetra massa. Praesent justo. Etiam nec velit.</info>   </contestantInfo></contestants>
The file size is larger than 8kb so I can't use fopen functions like in your PollsSystem. I might try to use this XML as a static resource file and create smaller XML files to hold votes, but that seems a little redundant...

Again, Thanks fort the suggestion!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #4 (permalink)  
Old 11-01-08, 20:21
Junior Member
 
Join Date: Dec 2007
Location: Oklahoma City OK USA
Posts: 4
Rep Power: 0
jWeis is on a distinguished road
Re: Flash PHP XML HELP!

Hi Flep! I love the site and your Utilities and resources are great!

Thanks for the suggestion. I tried it but I still can't get the script to edit the xml.

Here's the xml file I'm working with..
workingFiles.zip


The file size is larger than 8kb so I can't use fopen functions like in your PollsSystem. I might try to use this XML as a static resource file and create smaller XML files to hold votes, but that seems a little redundant...

Again, Thanks fort the suggestion!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #5 (permalink)  
Old 12-01-08, 07:52
Administrator
 
Join Date: Jul 2007
Location: Cesena
Posts: 4,486
Rep Power: 6
Flep is on a distinguished road
Re: Flash PHP XML HELP!

Hi, my suggestion was for a correct echo from PHP to Flash

I am not that good at PHP staff... I hope some other user can help you
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Flash Multi Gallery
  #6 (permalink)  
Old 12-01-08, 17:56
Junior Member
 
Join Date: Dec 2007
Location: Oklahoma City OK USA
Posts: 4
Rep Power: 0
jWeis is on a distinguished road
Re: Flash PHP XML HELP!

Thanks anyway!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:25.


Powered by vBulletin versione 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap


FlepStudio
by Filippo Lughi
P.IVA 03605860406