
October 7th, 2002, 07:00 PM
|
|
Junior Member
|
|
Join Date: Jul 2002
Posts: 20
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Table layout appearance with php help
i've wrote bog standard php code for putting MySql data into a table which is as follows
PHP Code:
$i=0;
while ($i < $num) {
$date=mysql_result($result,$i,"date");
$hometeam=mysql_result($result,$i,"hometeam");
$scoredhome=mysql_result($result,$i,"scoredhome");
$scoredaway=mysql_result($result,$i,"scoredaway");
$awayteam=mysql_result($result,$i,"awayteam");
$matchreport=mysql_result($result,$i,"matchreport");
$notes=mysql_result($result,$i,"notes");
$yr=strval(substr($date,2,2));
$mo=strval(substr($date,5,2));
$da=strval(substr($date,8,2));
?>
<tr>
<td align="center"><font color="#FFFFFF" size="1" face="verdana"><? echo "$da-$mo-$yr"; ?></font></td>
<td align="center"><font color="#FFFFFF" size="1" face="verdana"><? echo "$hometeam"; ?></font></td>
<td align="center"><font color="#FFFFFF" size="1" face="verdana"><? if ($scoredhome < 99) {echo "$scoredhome";} else {echo " ";} ?></font></td>
<td align="center"><font color="#FFFFFF" size="1" face="verdana"><? if ($scoredaway <99) {echo "$scoredaway";}else {echo " ";} ?></font></td>
<td align="center"><font color="#FFFFFF" size="1" face="verdana"><? echo "$awayteam"; ?></font></td>
<td align="center"><font color="#FFFFFF" size="1" face="verdana"><? if ($notes !="") {echo "$notes";} else {echo " ";} ?></font></td>
<td align="center"><font color="#FFFFFF" size="1" face="verdana"></font></td>
</tr>
<?
++$i;
}
MYSQL_CLOSE();
?> </table>
What i want to do is change the backgound colour of the table rows every other row to make the data easier to read but after trying several ways i'm stuck and hoping someone here can help me with this problem. What i mean is i want the first row of the table to be a dark grey, the next row to be a lighter grey, the next row to be dark grey and so on. Thanks for your time.
Edit: Please enclose code within "php" & "/php" brackets.
Last edited by FrankieShakes : October 7th, 2002 at 08:36 PM.
|