here is part of my code in which im trying to put in alternating row colors for a table. the code i have tried using is in red. the mouseover stuff works, but i cant get to alternate row colors.
any help/suggestions is appriciated
// $player_sql = mysql_query("SELECT * FROM players WHERE draftround = " . $draftround . " AND draftposition > 0 AND draftteam > 0001 AND draftseason = " . $season . " ORDER BY draftposition ASC");
$player_sql = mysql_query("SELECT * FROM players WHERE draftround = " . $draftround . " AND draftposition > 0 AND draftteam > 0001 ORDER BY draftposition ASC");
[COLOR="Red"] $i = 0;[/COLOR]
while($row = mysql_fetch_assoc($player_sql)){
[COLOR="Red"] $tbgcolor = is_int($i / 2)?"#efefef":"#ffffff";[/COLOR]
$rowx = mysql_fetch_assoc(mysql_query("SELECT id,name FROM teams WHERE id = " . $row['draftteam']));
$score = mysql_fetch_assoc(mysql_query("SELECT SUM(played) as played,SUM(goals) as goals,SUM(assists) as assists,SUM(minutes) as minutes FROM player_stats WHERE playerid = '" . $row['id'] . "'"));
$drafts .= "
[COLOR="Red"] <tr bgcolor=\"".$tbgcolor."\" align=\"center\" onmouseover=\"this.style.backgroundColor='#999999';\" onmouseout=\"this.style.backgroundColor='$tbgcolor';\">[/COLOR]
<td class=\"table_text\">" . $row['draftposition'] . "</td>
<td class=\"table_text\"><a href=\"http://snapshot-hockey.net/ufhl1/?opt=viewteam&id=" . $rowx['id'] . "\">" . $rowx['name'] . "</a></td>
<td class=\"table_text\"><a href=\"http://snapshot-hockey.net/ufhl1/?opt=viewplayer&pid=" . $row['id'] . "\">" . $row['fname'] . " " . $row['lname'] . "</a></td>
<td class=\"table_text\">" . $score['played'] . "</td>
<td class=\"table_text\">" . $score['goals'] . "</td>
<td class=\"table_text\">" . $score['assists'] . "</td>
<td class=\"table_text\">" . ($score['goals'] + $score['assists']) . "</td>
<td class=\"table_text\">" . $score['minutes'] . "</td>
</tr>";
}
$drafts .= "</table></table><br />";
}