Hallo zusammen
bei einer Schleife möchte ich die Tabellenzeilen abwechselnd farbig darstellen, und habe das mal hier:
<?php
<table width="450" height="18">
<?php do
{ ?>
<?php if ($row_rs1['titel'] != "" ) { ?>
<tr>
<td width="292" valign="top" class="titel"> <?php echo $row_rs1['titel']; ?>
<div align="center"></div>
</td>
<td width="143" valign="top" class="titel"><?php echo $row_rs1['erscheinungsjahr']; ?> </td>
</tr>
<?php } ?>
<?php
function bgcolor($row = 1) {
static $i;
static $col = array('#CCCCCC',
'#DDDDDD'
); // etc.
$bg = $col[(int)($i + .00000001)];
$i += 1 / $row;
if ($i >= count($col)) $i = 0;
return $bg;
} while ($row_rs1 = mysql_fetch_assoc($rs1)); ?>
</table>
?>
Aber es funktioniert nicht. Kann mir jemand zeigen wo ich den Fehler habe?
Merci