H2.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>
<style>
table, th, td{
border: 1px solid black;
border: collapse: collapse;
}
<?php
include ('db.php');
$query = "SELECT voornaam, tussenvoegsel, achternaam FROM leerlingen ORDER BY achternaam";
$result = mysqli_query($db, $query) or die (mysqli_error($db));
echo "<table>";
echo "<tr>";
echo "<th>Voornaam</th><th>Tussenvoegsel</th><th>Achternaam</th></th>";
echo "</tr>";
while($row = mysqli_fetch_array($result)){
echo "<tr>";
echo "<td>$row[0]</td><td>$row[1]</td><td>$row[2]</td>";
echo "</tr>";
}
echo "</table>";
?>
</body>
</html>
Resultaat
Made by Thijs Aarnoudse