Ik vrees dat je het niet helemaal begrijpt.
Dit is de volledige code:
<table style="font-size: 70%;">
<?php
$sql = "SELECT `RecordID`, `Naam`, `Jaar`, `Discipline`, `Prestatie` FROM tblRecords WHERE Type = '" . $obj->Type . "' AND Geslacht = '" . $obj->Geslacht . "' AND OI='Outdoor';";
if ($list = mysql_query($sql, $link)) {
$flip = 0;
while($record = mysql_fetch_object($list)) {
$flip ^= 1;
if($_SESSION['level'] == 1) {
$edit = "onclick=\"self.location.href='a_edit_clubrecord.php?id=" . $record->RecordID . "'\"";
} else {
$edit = "";
}
if ($flip) {
$edit .= ' style="background: #fff"';
}
else {
$edit .= ' style="background: #eee"';
}
?>
<tr onmouseover="this.style.backgroundColor='#afe890'" onmouseout="this.style.backgroundColor='#fff'"<?php echo $edit; ?>>
<td style="width: 100px;"><?php echo htmlentities(stripslashes($record->Discipline)); ?></td>
<td style="width: 350px;"><?php echo htmlentities(stripslashes($record->Naam)); ?></td>
<td style="width: 50px;"><?php echo htmlentities(stripslashes(stripslashes($record->Prestatie))); ?></td>
<td style="width: 50px;"><?php echo htmlentities(stripslashes($record->Jaar)); ?></td>
</tr>
<?php
}
}
?>
</table>
Je ziet dus dat ik maar 1 keer de opmaak van de tabel staan heb, en dat hij automatisch de rijen om en om een andere kleur geeft.
En zo?
<?php
$sql = "SELECT `RecordID`, `Naam`, `Jaar`, `Discipline`, `Prestatie` FROM tblRecords WHERE Type = '" . $obj->Type . "' AND Geslacht = '" . $obj->Geslacht . "' AND OI='Outdoor';";
if ($list = mysql_query($sql, $link)) {
$flip = 0;
while($record = mysql_fetch_object($list)) {
$flip ^= 1;
if($_SESSION['level'] == 1) {
$edit = "onclick=\"self.location.href='a_edit_clubrecord.php?id=" . $record->RecordID . "'\"";
} else {
$edit = "";
}
if ($flip) {
$edit .= " onmouseover=\"this.style.backgroundColor='#afe890'\" onmouseout=\"this.style.backgroundColor='#fff'\" style=\"background: #fff\"";
}
else {
$edit .= " onmouseover=\"this.style.backgroundColor='#afe890'\" onmouseout=\"this.style.backgroundColor='#eee'\" style=\"background: #eee\"";
}
?>
<tr<?php echo $edit; ?>>
<td style="width: 100px;"><?php echo htmlentities(stripslashes($record->Discipline)); ?></td>
<td style="width: 350px;"><?php echo htmlentities(stripslashes($record->Naam)); ?></td>
<td style="width: 50px;"><?php echo htmlentities(stripslashes(stripslashes($record->Prestatie))); ?></td>
<td style="width: 50px;"><?php echo htmlentities(stripslashes($record->Jaar)); ?></td>
</tr>
<?php
}
}
?>
Edit: Code tags toegevoegd.