hip1/14.6.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> </head> <body> <?php include('db.php'); $query = "select a.auteurnr, voornaam, achternaam, titel from auteurs a, boeken b where a.auteurnr = b.auteurnr order by auteurnr"; $result = mysqli_query($db, $query); while($row = mysqli_fetch_array($result)){ if($row['auteurnr'] != $currentauthor){ echo "<h2>$row[voornaam] $row[achternaam]</h2>"; $currentauthor = $row['auteurnr']; } echo "<div>$row[titel]</div>"; } ?> </body> </html>

Resultaat

Made by Thijs Aarnoudse