OrganizedChaos
MIS
I have a piece of code that is extracting info from a XML feed, parsing it and displaying the data on a PHP page. The last piece of code diplays the array, but I seem to have an issue with it.
Here is the code snippit:
Variables are as follows
$roster= A number that represents amount of teams
$number= Represents players per team
$userdata = Data that is put in an array from the XML feed
$fran = Individual franchises or teams
$player= players on each team
The Teams are being displayed properly, followed by the correct number of players also displayed properly for the first set. But when it gets past the first team, all the teams still display correctly, but the players still display the players from the first team.
It acts as if $i here -->$player[] = $userdata[$i]["id"][$a]; is always 0, but if I place a print $i in before this line, it properly displays the correct number in each group of players?
If I manually change this $i to 1,2,3 etc, all the players change to their expected values.
any ideas?
Thank you.
mike
Here is the code snippit:
Code:
$roster='12';
$number='15';
$i=0;
while ($i < $roster) {
$fran = $userdata[$i]["fid"];
print "<b>Team: $fran</b><br>";
$a=0;
while ($a < $number) {
$player[] = $userdata[$i]["id"][$a];
print "Player: $player[$a] <br>";
$a++;
}
$i++;
}
Variables are as follows
$roster= A number that represents amount of teams
$number= Represents players per team
$userdata = Data that is put in an array from the XML feed
$fran = Individual franchises or teams
$player= players on each team
The Teams are being displayed properly, followed by the correct number of players also displayed properly for the first set. But when it gets past the first team, all the teams still display correctly, but the players still display the players from the first team.
It acts as if $i here -->$player[] = $userdata[$i]["id"][$a]; is always 0, but if I place a print $i in before this line, it properly displays the correct number in each group of players?
If I manually change this $i to 1,2,3 etc, all the players change to their expected values.
any ideas?
Thank you.
mike