CodersNet Board  

Go Back   CodersNet Board > Programming help > PHP
   

PHP Discussions about PHP are in here.

Reply
 
Thread Tools Display Modes
Old 09-14-2008, 06:42 PM     #1
Chnum
Junior Member
 
Chnum's Avatar
 
Join Date: Aug 2007
Posts: 20
Rep Power: 0 Chnum is infamous around these parts
php xml

hello there,

i m trying to read from a xml file correctly. well it's not working at all

http://nopaste.codersnet.org/pastes.php?view=205

this is the xml file.

i m using simplexml and i tried to get all data from it. it works! BUT have a look at the <nocreation> tags. there are three in each riddle tag. so i decided to make it like this:

PHP Code:
foreach($xml->episode->riddle as $riddle)
{
     
// do something with that fucking data

    
foreach($xml->episode->riddle->noreaction as $noreaction)
    {
        
// bla bla something 
    
}

so for every riddle the php processor should read out all riddles. well i suppose he is doing that but everytime i start the script the output is not the output that i want to have. riddle one is correct but riddle nr 2 has exactly the same values for it's noreaction tags. well the xml file says something different. so what the hell is going on here?

greetings

chnum
Chnum is offline



 
Reply With Quote
Old 09-15-2008, 02:38 PM     #2
Chnum
Junior Member
 
Chnum's Avatar
 
Join Date: Aug 2007
Posts: 20
Rep Power: 0 Chnum is infamous around these parts
Re: php xml

finally i found out what the error was. the second foreach loop has to be like this:

PHP Code:
foreach($riddle->noreaction as $noreaction)
{
       
// something nice here

Chnum is offline



 
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
Forum Jump


All times are GMT +2. The time now is 08:05 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

© 2004-2010 CodersNet IRC-Network