XML and PHP

Associate
Joined
6 Mar 2009
Posts
495
Hi Guys, quick question which my be simple to yous.

I have a xml file containing data and I am using php to output it into a table.

I have it working except for outputting the id value.

For example I have a list of memos in the xml file and each memo has an id.

Here is the part of the code which I don't think is correct:

Code:
foreach($memos->childNodes as $memo) {
      $memoIDNode=$memo->getAttribute('id');
      $memoTitleNode=$memo->childNodes->item(0); 
	  $memoSenderNode=$memo->childNodes->item(1);
	  $memoRecipientNode=$memo->childNodes->item(2);

As said all the other parts output to the table except the 'id'. Tried doing '@id' as you would in xsl but didn't work

Cheers
 
Back
Top Bottom