Jump to content

danbliz

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

danbliz's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have a xml file with a value in it that I want to increment by one each time the page is viewed. Here is the xml file: <?xml version="1.0" encoding="utf-8"?> <thermometer> <goal goalNum="2553"><![CDATA[<b>2,553</b>]]></goal> <current currentNum="102" /> </thermometer> I need to increment currentNum by one. I keep trying different things, but can't seem to get it to work. Here is what I have: $dom = new DOMDocument(); $dom->load('tharmameter.xml'); $xpath = new DOMXPath($dom); $currentNumber = $xpath->query('thermometer/current/currentNum'); $newNum = $currentNumber + 1; $currentNum->nodeValue = $newNum; $dom->save('tharmameter.xml'); Can anyone tell me what I am doing wrong? Thanks!
×
×
  • 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.