l105/H14/14.1.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> table, th, td { border: 1px solid black; border-collapse: collapse; } </style> </head> <body> <?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)) {//alle records langslopen (als je in html wilt elke keer "" gebruiken.) echo "<tr>"; echo "<td>$row[0]</td><td>$row[1]</td> <td>$row[2]</td>"; } echo "</table>"; ?> </body> </html>

Resultaat

Made by Thijs Aarnoudse