Hulp tabel row achtergrond
require("mysql.php");
$sql = "SELECT id,datum,filiaal,naam,modelop FROM klanten ORDER BY datum DESC";
$res = mysql_query($sql);
echo "<img border=\"0\" src=\"logo.jpg\" width=\"94\" height=\"89\">";
echo "<font size=\"5px\"><b>klanten woongaard-meubelen:</b></font>";
echo"<table border=\"0\" width=\"100%\" style=\"border-collapse: collapse\">
<tr>
<td> datum: </td>
<td> naam: </td>
<td> filiaal: </td>
<td> model en opstelling: </td>
</tr>";
if (mysql_num_rows($res) >= 1)
{
while ($row = mysql_fetch_array($res))
{
echo"
<tr bgcolor=\"gray\">
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[datum]</span></a> </td>
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[naam]</span></a> </td>
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[filiaal]</span></a> </td>
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[modelop]</span></a> </td>
</tr>";
}
}
else {
echo "<font color=\"red\">De klanten database is leeg!</font>";
}
Gewijzigd op 17/01/2005 15:16:00 door Geoffrey Mastenbroek
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?
while ($row = mysql_fetch_array($res))
{
if($row[id]%2=0){
echo"<tr bgcolor=\"gray\">
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[datum]</span></a> </td>
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[naam]</span></a> </td>
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[filiaal]</span></a> </td>
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[modelop]</span></a> </td>
</tr>";
}else{
echo"<tr bgcolor=\"blue\">
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[datum]</span></a> </td>
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[naam]</span></a> </td>
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[filiaal]</span></a> </td>
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[modelop]</span></a> </td>
</tr>";
}
}
?>
while ($row = mysql_fetch_array($res))
{
if($row[id]%2=0){
echo"<tr bgcolor=\"gray\">
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[datum]</span></a> </td>
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[naam]</span></a> </td>
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[filiaal]</span></a> </td>
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[modelop]</span></a> </td>
</tr>";
}else{
echo"<tr bgcolor=\"blue\">
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[datum]</span></a> </td>
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[naam]</span></a> </td>
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[filiaal]</span></a> </td>
<td> <a href=\"klant.php?id=$row[id]\"><span style=\"text-decoration: none\">$row[modelop]</span></a> </td>
</tr>";
}
}
?>
Dit is niet helemaal waterdicht want af en toe zijn er 2 row's achter elkaar met dezelfde kleur
Code (php)
Zoiets dan...