hi all.
the code i have below lists all players who scored a goal in a certain game. the code works fine, but when all players are listed the player that is listed last has a comma after his name. i would like to remove it somehow. the code also shows if a player scores more that 1 goal in ( )
i have the comma in red in the code below.
$homegoals = mysql_query("SELECT * FROM schedule_scores WHERE "
."(team1 = '$id' OR team2 = '$id') "
."AND season = '$sid' "
."AND team1_score > '-' "
."ORDER BY date DESC, time DESC LIMIT 1");
$gameid = mysql_result($homegoals,0,"id");
$gm_team1 = mysql_result($homegoals,0,"team1");
$result_t1 = mysql_query("SELECT * FROM teams WHERE id = '".$gm_team1."'");
$t1_name = mysql_result($result_t1,0,"name");
$team1 = mysql_result($homegoals,$i,"team1");
$team2 = mysql_result($homegoals,$i,"team2");
$t1div = mysql_result($homegoals,$i,"team1_div");
$t2div = mysql_result($homegoals,$i,"team2_div");
$result_pi = mysql_query("SELECT * FROM players WHERE teamid = '".$gm_team1."' AND registered = '1'");
$total_pi = mysql_numrows($result_pi);
$i = 0;
while($i < $total_pi) {
$pid = mysql_result($result_pi,$i,"id");
$result_ps = mysql_query("SELECT * FROM player_stats WHERE playerid = '".$pid."' AND game_id = '$gameid' AND goals > '0'");
$total_ps = mysql_numrows($result_ps);
if($total_ps > 0) {
$goals = mysql_result($result_ps,0,"goals");
} else {
$goals = "0";
}
if($goals > 1) {
$stats12 .= "
<a href=\"index.php?opt=viewplayer&pid=".$pid."&divid=".$t1div."&sid=$sid&tid=".$team1."\">".mysql_result($result_pi,$i,"fint")." ".mysql_result($result_pi,$i,"lname")."</a>
";
$stats12 .= " ($goals), ";
} elseif($goals > 0) {
$stats12 .= "
<a href=\"index.php?opt=viewplayer&pid=".$pid."&divid=".$t1div."&sid=$sid&tid=".$team1."\">".mysql_result($result_pi,$i,"fint")." ".mysql_result($result_pi,$i,"lname")."[COLOR="Red"],[/COLOR] </a>
";
}
$i++;
unset($result_ps);
}