Scatless Posted April 16, 2011 Share Posted April 16, 2011 Hi, got a problem with my arrays, every string gets duplicated 11 times instead of just one time. How to fix this? Quote Link to comment https://forums.phpfreaks.com/topic/233907-array-duplicates-11-times-instead-of-one-output/ Share on other sites More sharing options...
Skewled Posted April 16, 2011 Share Posted April 16, 2011 Some code might help... If we can't see how your dealing with the Array how are we suppose to help? Quote Link to comment https://forums.phpfreaks.com/topic/233907-array-duplicates-11-times-instead-of-one-output/#findComment-1202352 Share on other sites More sharing options...
maxudaskin Posted April 16, 2011 Share Posted April 16, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/233907-array-duplicates-11-times-instead-of-one-output/#findComment-1202371 Share on other sites More sharing options...
Scatless Posted April 17, 2011 Author Share Posted April 17, 2011 <?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"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/233907-array-duplicates-11-times-instead-of-one-output/#findComment-1202586 Share on other sites More sharing options...
maxudaskin Posted April 17, 2011 Share Posted April 17, 2011 Can you give us an example of the data it's using? -- OFF TOPIC -- Also, did you hear about BF3? They made an entirely new engine (again) that allows for even more destruction in an urban area. Check it out Quote Link to comment https://forums.phpfreaks.com/topic/233907-array-duplicates-11-times-instead-of-one-output/#findComment-1202637 Share on other sites More sharing options...
Scatless Posted April 17, 2011 Author Share Posted April 17, 2011 i've fixed the problem, was just an issue with the foreach Quote Link to comment https://forums.phpfreaks.com/topic/233907-array-duplicates-11-times-instead-of-one-output/#findComment-1202642 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.