Hi!
I hope someone can help me with this, I am getting kind of desperate.
I am working on an XML parser and I have 2 foreach statements in this code. I need them to run as one but I tried foreach ($params as $param && $note as $value) but no luck. As it is now all the odds are displayed before all the games, but they should be displayed together. Hope someone has some knowledge about this.
/Carl
$dom = new DomDocument;
$dom->load("http://odds.expekt.com/exportServlet");
$dom->preserveWhiteSpace = FALSE;
$params = $dom->getElementsByTagName('alternative');
$note = $dom->getElementsByTagName("game");
foreach ($params as $param) {
$odds= $param -> getAttribute('odds');
echo "$odds<br/>";
}
foreach( $note as $value)
{
$descriptions = $value->getElementsByTagName("description");
$description = $descriptions->item(0)->nodeValue;
$categories = $value->getElementsByTagName("category");
$category = $categories->item(0)->nodeValue;
$alts = $value->getElementsByTagName("alternatives");
$alt = $alts->item(0)->nodeValue;
if ($category==NHL) {
echo "$description <br/>$alt<br/>";
}
}