m-eye
m-eye

Reputation: 23

PHP XML foreach

XML and foreach question

the Title is not issued with unfortunately why? where did I fail can someone help me?

foreach ($xml->data->SONGHISTORY->SONG as $dj) {
     echo $dj->PLAYEDAT;
     echo $dj->TITLE;
 }

Upvotes: 0

Views: 107

Answers (1)

Phil
Phil

Reputation: 164795

To me, it seems simply that there is no data node in the XML. From your var_dump output, you should be using this...

foreach ($xml->SONGHISTORY->SONG as $dj) {
    echo $dj->PLAYEDAT, ' ', $dj->TITLE, PHP_EOL;
}

Upvotes: 2

Related Questions