Alternate coloured row code problem
Posted: Tue Jul 15, 2003 5:34 am
Hello, I am having problems getting the colours to show. Here is the code:
Which part of the code may be causing the problem and how do i fix it so that the alternate colours show on the page. Thanx
Code: Select all
<?php
$colour1 = '#CCCCCC';
$colour2 = '#FFFFFF';
$rowcount = 0;
if ($_GET['search_hub']) {
$sql = "SELECT routes.routeid, depart.depart, depart.departcode, arrive.arrive, arrive.arrivecode
FROM (routes INNER JOIN depart
ON routes.departid = depart.departid)
INNER JOIN arrive ON routes.arriveid = arrive.arriveid
WHERE depart.departcode = '".$_GET['search_hub']."'";
$result = mysql_query($sql, $db);
print "<table width='75%' border=0 align='center'>";
print "<tr bgcolor'$rowcolour'><th><p><b>Route Code</b></th><th><p><b>Departure Airport</b></th><th><p><b>Code</b></th><th><p><b>Arrival Airport</b></th><th><p><b>Code</b></th></tr>";
while
($row = mysql_fetch_array($result)) {
print "<tr><td align='center'><p>AR".$row['routeid']."</td>";
print "<td align='center'><p>".$row['depart']."</td>";
print "<td align='center'><p>".$row['departcode']."</td>";
print "<td align='center'><p>".$row['arrive']."</td>";
print "<td align='center'><p>".$row['arrivecode']."</td></tr>";
$rowcolour = ($rowcount%2)?$colour1:$colour2;
$rowcount++; }
print "</table>"; }
?>