Hver anden række skal have en anden baggrundsfarve
Jeg kunne godt tænke mig baggrundsfarven på de forskellige <tr> skiftevis var #f1f1f1 og #ffffff, hvordan kan man lave dette?Følgende er mit php script:
<?php
mysql_connect("localhost", "********", "********") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
$id = (int) $_GET['mobile_id'];
$sql = 'SELECT
mobiledeals.*, mobileplans.*, mobilenetworks.*
FROM mobiledeals
INNER JOIN mobileplans ON mobileplans.id = mobiledeals.mobileplans_id
INNER JOIN mobilenetworks ON mobilenetworks.id = mobileplans.network_id
WHERE mobiledeals.mobilephone_id = '.$id.' ORDER BY mobiledeals.price, (mobileplans.abonnement*mobileplans.binding)+mobilenetworks.oprettelse+mobiledeals.price ASC';
$query = mysql_query($sql) or die(mysql_error());
$result = array();
while($row = mysql_fetch_assoc($query)) {
$result[] = $row;
}
?>
<table class="data" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="hd" style="width: 130px;"></td>
<td class="hd" style="width: auto;"></td>
<td class="hd" style="width: 145px;"></td>
</tr>
<?php foreach($result as $row): ?>
<tr onclick="java script:window.open('<?php echo $row['link1']; ?>');" class="trhand" bgcolor="#f1f1f1" onmouseover="this.bgColor = '#e3f4f8';" onmouseout ="this.bgColor = '#f1f1f1';return true;">
<td class="dataclass_udbyder">
<img src="img/teleselskaber/<?php echo $row['logo']; ?>" alt="<?php echo $row['network_name']; ?>" border="1" />
</td>
<td class="dataclass">
<div class="dataover"><? echo $row['name']; ?></div>
<div class="dataclass2"><b>Minuttakst:</b> DKK <?php echo $row['minuttakst']; ?><br /><b>Taksering:</b> <?php echo $row['taksering']; ?><br /><b>Opkaldsafgift:</b> DKK <?php echo $row['opkaldsafgift']; ?></div>
<div class="dataclass2"><b>SMS pris:</b> DKK <?php echo $row['sms']; ?><br /><b>MMS pris:</b> DKK <?php echo $row['mms']; ?><br /><b>Data pris:</b> DKK <?php echo $row['data']; ?></div>
<div class="dataclass2"><b>Abonnement:</b> DKK <?php echo $row['abonnement']; ?>,-/md.<br /><b>Binding:</b> <?php echo $row['binding']; ?> mdr.<br /><b>Oprettelse:</b> DKK <?php echo $row['oprettelse']; ?>,-</div>
</td>
<td class="dataclass_koeb rh">
<div class="pris">Pris DKK <?php echo $row['price']; ?>,-</div><img src="img/koebnu.png" alt="Køb nu!" /><br /><div class="mindstepris">Mindstepris DKK <?php $sum_total = ( $row['abonnement'] * $row['binding'] ) + $row['oprettelse'] + $row['price']; print ($sum_total); ?>,-</div>
</td>
</tr>
<?php endforeach; ?>
</table>