one of mt favorite uses for a ternary.
(assuming $info['Teams'] is 9/jv/v:
PHP Code:
while($info = mysql_fetch_array( $data ))
{
$varsity = ($info['Teams'] == "varsity") ? ' class="varsity" ' : '' ;
Print "<tr $varsity><td>".$info['CleanDate'] . "</td><td>".$info['Teams'] . "</td><td>".$info['Opponent'] . "</td><td>".$info['TimeScore'] . "</td><td>".$info['HomeAway'] . "</td></tr>";
}
then as Tirna suggested, you can create a css style
HTML Code:
<style type="text/css">
tr.varsity {
background-color: #444;
color: #c00;
}
</style>
Since you left the "or" part of the ternary blank, if it's not a varity team, there just wont be a class defined. You could also define a default style to put in there, or even stack the ternarys to color each team.
PHP Code:
$varsity = ($info['Teams'] == "9") ? ' class="nine" ' : '' ;
$varsity = ($info['Teams'] == "jvarsity") ? ' class="jvarsity" ' : '' ;
$varsity = ($info['Teams'] == "varsity") ? ' class="varsity" ' : '' ;
Bookmarks