Home › Forums › CSS › CSS and "traffic-lighting" values in a table › Re: CSS and “traffic-lighting” values in a table
Hi latte,
See below the php i used for pulling in my data from my matches table:
$r2 = mysql_fetch_array(mysql_query(“SELECT * FROM $teams WHERE team_id='”.$r[“match_team”].”‘”));
echo “

echo “ vs. n”;
echo ““.$r[“match_opponent”].”n”;
$match_score1=$r[“match_score1”];
$match_score2=$r[“match_score2”];
if ($match_score1 > $match_score2)
{
echo ““.$r[“match_score1″].” – “.$r[“match_score2″].”“;
}
elseif ($match_score1 < $match_score2)
{
echo "“.$r[“match_score1″].” – “.$r[“match_score2″].”“;
}
else
{
echo ““.$r[“match_score1″].” – “.$r[“match_score2″].”“;
}
$r3 = mysql_fetch_array(mysql_query(“SELECT * FROM $events WHERE event_id='”.$r[“match_event”].”‘”));
echo ““.$r3[“event_name”].”n”;
echo ““.$r[“match_date”].”n”;
echo “
n”;
}
?>
I’ve added a couple of line breaks between the if statements.
You will see that each if, elseif, and else each have a different span: <span class=’loss’>
This is obviously just defined in the stylesheet such as:
You can ofcourse credit me in your app if you see fit to :) my website is:
http://www.est87.co.uk