I have a script that shows information on a game server. Shows like player name and score, etc..
Now within the site I have each clan member registers their in game handle so people know who each member in the clan is.
Now in the script that shows the game server info it shows the player name, and by my theory the same name in the clan is the same name used in the actual game, which get's displayed.
Now what I'm trying to do is a query gets done and gets all the member handles and compares it to the list in the game server info. If the in game handle within the game matches the handle that is in the MySQL database it creates a link to that member's profile page.
Now this is what I have created:
<?php
$p = "SELECT * FROM clanMembers";
$r = mysql_query($p);
$player = array();
while($userRow = mysql_fetch_assoc($r))
{
$player[$userRow['ID']] = array (
'ID' => $userRow['ID'],
'haloHandle' => $userRow['haloHandle']
);
}
foreach($player as $id => $playerInfo)
{
if ($data[$server_id][players][$np][player] == $playerInfo['haloHandle'])
{
echo "<a href=\"" .$_SERVER['PHP_SELF'] ."?action=members&memrefID=" .$playerInfo['ID'] ."\">" .$playerInfo['haloHandle'] ."</a>";
}
else
{
echo $data[$server_id][players][$np][player];
}
}
?>
Now the problem is it displays and creates the link fine, but then echos the player name again. so you would get duplicate names rather than just echoing it just once. What can I do it so it just echo's once. Any help would be great.
Here's the link:
http://www.unisonclan.com/index.php?action=test&game=halo you'll see what I'm talking about. BTW I'm "MÂßÂѧ" on there.