Hello All,
I have been working on a little script, I am at a slight problem and was hoping for a little assistance.
I am trying to change the color of a cell in my table based on a value change:
It is a "Standings" page, where If a team has been noted as a "Winner", the cell be green, or if the team is a "Loser", then the cell color be red.
This is AMERICAN FOOTBALL...hehe
I have it registering the correct winner if a team wins, and a counter to total the wins....now I want it to output in a table to reflect it by color.
Here is what I have:
[PHP]// Get all the data from the "example" table
$result = mysql_query("SE LECT * FROM picksheet WHERE week='1'")
or die(mysql_error ());
echo "<table border='1'<td class='v8'>" ;
echo "<tr><th>PoolMe ister</th> <th>Game01</th><th>Game02</th> <th>Game03</th> <th>Game04</th> <th>Game05</th> <th>Game06</th> <th>Game07</th> <th>Game08</th> <th>Game09</th> <th>Game10</th> <th>Game11</th> <th>Game12</th> <th>Game13</th> <th>Game14</th> <th>Game15</th> <th>Game16</th> <th>survivor</th> <th>margin</th> <th>Tiebreake r</th><th> Total Wins</th></tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_arr ay( $result )) {
// Print out the contents of each row into a table
{
echo "<tr><td class='v8'>";
echo $row['user_name'];
echo "</td><td class='v8'>";
echo $row['Game01'];
if('$Game01'==' $Game1Winner')
{
print '<TH bgcolor="green" >\n';
}
else
{
print '<TH bgcolor="red">\ n';
}
echo "</td><td class='v8'>";
echo $row['Game02'];
echo "</td><td class='v8'>";
echo $row['Game03'];
echo "</td><td class='v8'>";
echo $row['Game04'];
echo "</td><td class='v8'>";
echo $row['Game05'];
echo "</td><td class='v8'>";
echo $row['Game06'];
echo "</td><td class='v8'>";
echo $row['Game07'];
echo "</td><td class='v8'>";
echo $row['Game08'];
echo "</td><td class='v8'>";
echo $row['Game09'];
echo "</td><td class='v8'>";
echo $row['Game10'];
echo "</td><td class='v8'>";
echo $row['Game11'];
echo "</td><td class='v8'>";
echo $row['Game12'];
echo "</td><td class='v8'>";
echo $row['Game13'];
echo "</td><td class='v8'>";
echo $row['Game14'];
echo "</td><td class='v8'>";
echo $row['Game15'];
echo "</td><td class='v8'>";
echo $row['Game16'];
echo "</td><td class='v8'>";
echo $row['Survivor'];
echo "</td><td class='v8'>";
echo $row['Margin'];
echo "</td><td class='v8'>";
echo $row['Tiebreaker'];
echo "</td><td class='v8'>";
echo "$Winner";
echo "</td></tr>";
}
}
echo "</table>";
?>
</u>[/PHP]
$Game1Winner is correct variable for the winner of Game01
My table comes out with one red cell and the fields are pushed 1 spot to the right??
Any help would be great
Thanx,
Patsman77
I have been working on a little script, I am at a slight problem and was hoping for a little assistance.
I am trying to change the color of a cell in my table based on a value change:
It is a "Standings" page, where If a team has been noted as a "Winner", the cell be green, or if the team is a "Loser", then the cell color be red.
This is AMERICAN FOOTBALL...hehe
I have it registering the correct winner if a team wins, and a counter to total the wins....now I want it to output in a table to reflect it by color.
Here is what I have:
[PHP]// Get all the data from the "example" table
$result = mysql_query("SE LECT * FROM picksheet WHERE week='1'")
or die(mysql_error ());
echo "<table border='1'<td class='v8'>" ;
echo "<tr><th>PoolMe ister</th> <th>Game01</th><th>Game02</th> <th>Game03</th> <th>Game04</th> <th>Game05</th> <th>Game06</th> <th>Game07</th> <th>Game08</th> <th>Game09</th> <th>Game10</th> <th>Game11</th> <th>Game12</th> <th>Game13</th> <th>Game14</th> <th>Game15</th> <th>Game16</th> <th>survivor</th> <th>margin</th> <th>Tiebreake r</th><th> Total Wins</th></tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_arr ay( $result )) {
// Print out the contents of each row into a table
{
echo "<tr><td class='v8'>";
echo $row['user_name'];
echo "</td><td class='v8'>";
echo $row['Game01'];
if('$Game01'==' $Game1Winner')
{
print '<TH bgcolor="green" >\n';
}
else
{
print '<TH bgcolor="red">\ n';
}
echo "</td><td class='v8'>";
echo $row['Game02'];
echo "</td><td class='v8'>";
echo $row['Game03'];
echo "</td><td class='v8'>";
echo $row['Game04'];
echo "</td><td class='v8'>";
echo $row['Game05'];
echo "</td><td class='v8'>";
echo $row['Game06'];
echo "</td><td class='v8'>";
echo $row['Game07'];
echo "</td><td class='v8'>";
echo $row['Game08'];
echo "</td><td class='v8'>";
echo $row['Game09'];
echo "</td><td class='v8'>";
echo $row['Game10'];
echo "</td><td class='v8'>";
echo $row['Game11'];
echo "</td><td class='v8'>";
echo $row['Game12'];
echo "</td><td class='v8'>";
echo $row['Game13'];
echo "</td><td class='v8'>";
echo $row['Game14'];
echo "</td><td class='v8'>";
echo $row['Game15'];
echo "</td><td class='v8'>";
echo $row['Game16'];
echo "</td><td class='v8'>";
echo $row['Survivor'];
echo "</td><td class='v8'>";
echo $row['Margin'];
echo "</td><td class='v8'>";
echo $row['Tiebreaker'];
echo "</td><td class='v8'>";
echo "$Winner";
echo "</td></tr>";
}
}
echo "</table>";
?>
</u>[/PHP]
$Game1Winner is correct variable for the winner of Game01
My table comes out with one red cell and the fields are pushed 1 spot to the right??
Any help would be great
Thanx,
Patsman77
Comment