hip1/12.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 "</br>$row[voornaam] $row[achternaam], $row[titel]";
$currentauthor = $row['auteurnr'];
}
else{
echo ", $row[titel]";
}
}
?>
</body>
</html>
Resultaat
Made by Thijs Aarnoudse