Mazz
Mazz

Reputation: 11

simplexml loop, loop count good data bad

Trying my first simplexml loop

I have got to this:

foreach ($xml->GetCapabilityResponse->Srvs->Srv as $rows)
{
echo $xml->GetCapabilityResponse->Srvs->Srv->GlobalProductCode . " ";
echo  $xml->GetCapabilityResponse->Srvs->Srv->MrkSrv->LocalProductCode . " " ; 
echo  $xml->GetCapabilityResponse->Srvs->Srv->MrkSrv->ProductShortName . "<br>";
}

It returns the correct amount of rows '6' but all 6 are the same data from the first row, how do I adjust to show the 6 different rows own data, it's not limited to 6, could be 12 or more etc

thanks Mazz

Upvotes: 0

Views: 29

Answers (1)

chorn
chorn

Reputation: 150

so if $rows is an array, you should rely on the item you are processing

$row->GlobalProductCode . " ";

Upvotes: 1

Related Questions