Re: [tcphp] alternating highlights
| From: | Josh Close | Date: | Tue, 03 Aug 2004 22:20:30 +0000 |
| Subject: | Re: [tcphp] alternating highlights | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-192628@lists.php.net to get a copy of this message | ||
This is very simple actually....
<?
$result = mysql_query($sql);
$flag = 0;
while($row = mysql_fetch_array($result)){
$field1 = $row['field1'];
$field2 = $row['field2'[;
if($flag){
?>
<tr style="background: blue;">
<td><?=$field1?></td>
</tr>
<?
$flag = 1;
}
else{
?>
<tr>
<td><?=$field1?></td>
</tr>
<?
$flag = 0;
}
}
?>
That was very quick, but I hope it helps.
-Josh