I would like to alternate my row colors in this script and was wondering what would be the best way to accomplish that with how my script is formatted...
<?php
include("/home/public_html/domain.php");
include("/home/public_html/dbConfig.php");
// CONNECT TO DATABASE
$db = @mysql_connect($host,$user,$password) or die("<html><head><body bgcolor=$bgcolor alink=$bglinkcolor vlink=$bglinkcolor link=$bglinkcolor><br><br><br><center><font color=FFFFFF face=verdana size=2>Database Error</font></center></body></html>");
@mysql_select_db($database,$db) or die("<html><head><body bgcolor=$bgcolor alink=$bglinkcolor vlink=$bglinkcolor link=$bglinkcolor><br><br><br><center><font color=FFFFFF face=verdana size=2>Database Error</font></center></body></html>");
// GET THE CURRENT SEASON FOR THE SPECIFIED LEAGUE
$mysql_query = "SELECT max(season) as season FROM game_summary WHERE league_id=$league_id";
$res=mysql_query($mysql_query,$db);
$season = mysql_result($res,0,"season");
$query = "SELECT team, wins, loses, ties, pts_for, pts_agst
FROM standings
WHERE league_id='$league_id'
AND season='$season'
AND team IN ('$team1', '$team2')";
$res = mysql_query($query,$db);
while (list($team, $wins, $loses, $ties, $pts_for, $pts_agst ) = mysql_fetch_row($res)) {
$results['Record'][$team] = $wins . '-' . $loses . '-' . $ties;
$results['Points for'][$team] = $pts_for;
$results['Points against'][$team] = $pts_agst;
}
echo "<table><tr><td>";
echo "<table><tr><td><table cellspacing=10 border=0 cellpadding=5><tr><th colspan=3>Offensive Matchup</th></tr>";
foreach ($results as $stat => $teamdata) {
echo '<tr><td width=205>', $stat , '</td><td width=50>', $teamdata[$team1], '</td><td align=right>', $teamdata[$team2], '</td></tr>';
}
The lines that I want the row color alternated on are these:
foreach ($results as $stat => $teamdata) {
echo '<tr><td width=205>', $stat , '</td><td width=50>', $teamdata[$team1], '</td><td align=right>', $teamdata[$team2], '</td></tr>';
}
Any help is appreciated!