PHP SimpleXML replaceChild() Error: “Call to undefined method[…]”

The Ownzman

New Member
I am running PHP5 on a Linux Apache ServerI am trying to use XML in my website as a simple database.I need to raise an integer (the content of a node) by one, and save the file.The Error Message is : Call to undefined method SimpleXMLElement::replaceChild()Here is my code: \[code\]<?php$x = $_GET['x'];$y = $_GET['y'];$z = $_GET['z']; $dom = simplexml_load_file("questions.xml");if ($dom->question['id'] == $x) { $poll = $dom->question->poll; if ($z == 0) { $yes = $poll->yes; $upper = $yes + 1; $yes->replaceChild($yes, $upper); } elseif ($z == 1) { $no = $poll->no; $lower = $no + 1; $no->replaceChild($no, $lower); }}?>\[/code\]questions.xml\[code\]<?xml version="1.0" encoding="utf-8" ?><questions> <question id="does-god-exist"> <poll> <yes>0</yes> <no>0</no> </poll> </question></questions>\[/code\]
 
Back
Top