x103/I2_1.php

<?php include "db.php" ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> td{ border: 1px solid black; } </style> </head> <body> <table> <?php $result = mysqli_query($db, "SELECT DISTINCT achternaam, titel, genre, pub_jaar FROM auteurs, boeken WHERE auteurs.auteurnr = boeken.auteurnr ORDER BY achternaam"); while($row = mysqli_fetch_array($result)){ echo "<tr>"; for($i = 0; $i < count($row)/2; $i++){ echo "<td>$row[$i]</td>"; } echo "</tr>"; } ?> </table> </body> </html>

Resultaat

Made by Thijs Aarnoudse