hip1/14.7.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.voornaam as avoornaam, a.achternaam as aachternaam, titel, datum_uit, l.voornaam, l.achternaam, l.llnr
from auteurs a, boeken b, uitleningen u, leerlingen l
where a.auteurnr = b.auteurnr and b.boeknr = u.boeknr and u.llnr = l.llnr
order by l.llnr";
$result = mysqli_query($db, $query) or die(mysqli_error($db));
while($row = mysqli_fetch_array($result)){
if($row['llnr'] != $currentstudent){
echo "<h2>$row[voornaam] $row[achternaam]</h2>";
$currentstudent = $row['llnr'];
}
echo "<div>$row[titel], $row[avoornaam] $row[aachternaam] $row[datum_uit]</div>";
}
?>
</body>
</html>
Resultaat
Made by Thijs Aarnoudse