<?php include("db.php"); $sql="SELECT * FROM brugere ORDER BY id DESC"; $result=mysql_query($sql); ?> <html> <body> <table> <tr> <td width="20">ID</td> <td width="100">Brugernavn</td> <td width="100">Navn</td> <td width="50">Alder</td> <td width="100">Email</td> <td width="20">Profil</td> </tr> <?php while($hent=mysql_fetch_array($result)){ ?> <tr> <td><? echo $hent['id']; ?></td> <td><? echo $hent['brugernavn']; ?></td> <td><? echo $hent['navn']; ?></td> <td><? echo $hent['alder']; ?></td> <td><? echo $hent['email']; ?></td> <td><a href="profil.php?id=<? echo $hent['id']; ?>>Profil</a></td> </tr> <?php } ?> </table> </body> </html>
while($hent = mysql_fetch_array($result)) { if ($hent['id'] % 2 == 0) { //id er lige. } else { //id er ulige } }