i have a table that lists 5 to 6 teams depending on what team page your viewing but what i am looking to do is highlight the row color of the team whose page i am on
ex -- say i am viewing Tampa Bay team page with a id = 22
i want to highlight Tampa Bay row in table
I was trying to add this into the code but not quite working for me
".($_GET["id"] == $row["name"]?" style='background-color:yellow'":"")."
<?php
function draw_table($o){
$result = '<table width="85%" border="0" cellspacing="0" cellpadding="0" align="center">'.
'<tr>'.
' <td bgcolor="#000000">'.
' <table border="0" width="100%" cellpadding="2" bordercolor="#000000" cellspacing="1">'.
' <tr align="center" bgcolor="'.$o['bgtitle'].'">'.
' <td colspan="'.count((isset($o['headers']) ? $o['headers'] : $o['fields'][0])).'" class="table_header">'.$o['title'].'</td>'.
' </tr>';
if ($o['headers']){
$result .= '<tr bgcolor="'.$o['bgheaders'].'" align="center">';
$index = 0;
foreach($o['headers'] as $h){
$result .= '<td class="table_header">'.($index == $o['bold'] ? "<b>" : "") . ($index == $o['bold'] ? strtoupper($h) : $h) . ($index == $o['bold'] ? "</b>" : "").'</td>';
$index ++;
}
$result .= '</tr>';
}
if ($o['fields']){
$i = 0;
foreach($o['fields'] as $f){
$result .= '<tr bgcolor="'.($i%2 == 0 ? $o['bgcolors'][0] : $o['bgcolors'][1]).'" align="center">';
$index = 0;
foreach($f as $v){
$result .= '<td class="table_text" '.($index == $o['bold'] ? 'bgcolor="#EFEFEF"' : "").'>'.($index == $o['bold'] ? "<b>" : "") . ($v != '' ? $v : '0') . ($index == $o['bold'] ? "</b>" : "").'</td>';
$index++;
}
$result .= '</tr>';
$i++;
}
}
if ($o['footer']){
foreach($o['footer'] as $f){
$first_time = 1;
$result .= '<tr bgcolor="'.$o['bgtitle'].'" align="center">';
foreach($f as $v){
$result .= '<td '.($first_time ? 'colspan="'.$o['footer_span'].'"' : '').' class="table_text"><b>'.($v != '' ? $v : '0').'</b></td>';
$first_time = 0;
}
$result .= '</tr>';
}
}
return $result.'</table></td></tr></table><br />';
}
function get_team($id,$sid){
include ("config.php");
$filename = "./sports/hockey/html/nhl_team.html";
$fd = fopen($filename, "r");
$contents = fread($fd, filesize($filename));
fclose($fd);
$open = mysql_connect($hostname,$user,$password);
mysql_select_db("$db",$open);
// INIT TEAMS
$result = mysql_query('SELECT * FROM `nhl_teams`');
while ($row = mysql_fetch_assoc($result)){
$teams[$row['id']] = $row;
if (!isset($photo2)) $photo2 = $teams[$id]['photo2'];
$tdiv = $teams[$id]['division'];
}
mysql_free_result($result);
$id = $teams[$id]['hub_name'];
//STANDINGS TABLE
$standings_table_array = array();
$standings_query = mysql_query("SELECT * FROM standing WHERE division = '$tdiv' AND year = '2013-14' ORDER BY pts DESC") or die(mysql_error());
while($row = mysql_fetch_assoc($standings_query)) {
$sc++;
$standings_table_array[] = array( $row['team'], $row['gp'], $row['w'], $row['l'], $row['t'], $row['otl'], $row['sol'], $row['pts'], $row['gf'], $row['ga']);
}
$standings_output .= draw_table(array(
'title' => 'STANDINGS',
'bold' => -1,
'headers' => array("Team", "GP", "W", "L", "T", "OTL", "SOL", "PTS", "GF", "GA"),
'fields' => $standings_table_array,
'bgtitle' => '#EFEFEF',
'bgheaders' => '#DFDFDF',
'bgcolors' => array('#FFFFFF', '#EFEFEF')
));
$logo = ' <td valign="top"><img src="http://www.theufhl.com/nhl/images/team-images/'.$photo2.'" width="1000" height="72"></td>';
$contents = str_ireplace("<!--%PHOTO2%-->", $logo, $contents);
$contents = str_ireplace("<!--%GOALIE_STATS%-->", $gs_output, $contents);
$contents = str_ireplace("<!--%DATA%-->", $output, $contents);
$contents = str_ireplace("<!--%STANDINGS%-->", $standings_output, $contents);
return $contents;
}
?>