Reputation: 385
So I have this XML File.
<?xml version="1.0" encoding="iso-8859-1"?>
<user>
<resource>
<reswood>150</reswood>
<resstone>150</resstone>
<ressteel>150</ressteel>
<limit>1000</limit>
</resource>
</user>
And this is the php file.
<?php
session_start();
$userlogin = $_SESSION['username'];
$xml=simplexml_load_file('data/' . $userlogin . '/' . $userlogin . '.xml');
echo $xml->reswood;
echo $xml->resstone;
echo $xml->ressteel;
?>
alright so I have changed to simple xml and now it just displays blank...
Upvotes: 0
Views: 38
Reputation: 3560
I really don't understand the question... "wood tag:" isn't valid PHP and would error out. Unless you wanted the output to actually say "echo" and stuff. But either way, you should really use SimpleXML instead of load to read the XML file, and then you can use XPath to navigate and access the XML data far easier.
Upvotes: 1