Jump to content

Array Duplicates 11 Times instead of one output


Scatless

Recommended Posts

Some code might help... If we can't see how your dealing with the Array how are we suppose to help?

+1

 

Please copy and paste the relevant code inside


tags. Don't forget the opening <?php tag, or it won't highlight your code.

<?php function print_teamOne($results) {

    $gqplayers = array('player_', 'score_', 'skill_', 'deaths_', 'gq_ping', 'team_');

    foreach ($results as $key => $val) {

    $teamOne = $val['bf2_team1'];

    print("<table align=\"left\"><tr><td>$teamOne</td></tr>\n");
    print("<tr><td><table><thead><tr><td>Player</td><td>Score</td><td>Kills</td><td>Deaths</td><td>Ping</td><td>Team</td></tr></thead><tbody>\n");
}

    foreach ($results['server']['players'] as $player) {

     foreach($player as $person => $team_) {
       if ($player['team_'] == 1) echo "<tr><td>".$player['player_']."</td><td>".$player['score_']."</td><td>".$player['skill_']."</td><td>".$player['deaths_']."</td><td>".$player['gq_ping']."</td><td>".$player['team_']."</td></tr>\n"; }
   
}
        print("</table>\n");
        print("</table>\n");
} ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.