Kortom gaarne wat opmerkingen tips over de opbouw:
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
$host = 'localhost';
$databaseUsername = 'xxxx';
$databasePassword = 'xxxx';
$database = 'vaarweginfo';
$connection = new mysqli($host, $databaseUsername, $databasePassword, $database);
if ($connection->connect_errno > 0) {
die ('Unable to connect to database [' . $connection->connect_error . ']');
}
$sql = "SELECT DATE_FORMAT(datetime, '%d-%m-%Y') AS datetime
FROM vaarweginfo
LIMIT 1";
if (!$result = $connection->query($sql)) {
die ('There was an error running query[' . $connection->error . ']');
}
$row = $result->fetch_array();
$datetime = $row['datetime'];
$sql = "SELECT notice
,vaarweg
,trajectbeperking
,beperking
,onderwerp
,reden
,DATE_FORMAT(periode_van, '%d-%m-%Y') AS periode_chr
,extra_informatie
,datetime
FROM vaarweginfo
WHERE gebied = 'Nord-Est'
ORDER by land, periode_van, vaarweg";
if (!$result = $connection->query($sql)) {
die ('There was an error running query[' . $connection->error . ']');
}
?>
<style type="text/css">
p.sansserif {
font-family: Arial, Helvetica, sans-serif;
font-size:80%;
}
p.vfont {
font-family: verdana,arial,sans-serif ;
font-size:75%;
}
table.table-style-one {
font-family: verdana,arial,sans-serif;
font-size:11px;
color:#333333;
border-width: 1px;
border-color: #3A3A3A;
border-collapse: collapse;
}
table.table-style-one th {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #3A3A3A;
background-color: #B3B3B3;
}
table.table-style-one td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #3A3A3A;
background-color: #ffffff;
}
</style>
<!-- Table goes in the document BODY -->
<br>
<p class="vfont">Je ziet nu Frankrijk, VNF district: <b>Nord-Est </b> (d.d. <?php echo $datetime; ?>)</p>
<br>
<br>
<table class="table-style-one">
<thead>
<tr>
<th>Bericht</th>
<th>Vaarweg</th>
<th>Trajectbeperking</th>
<th>Beperking</th>
<th>Onderwerp</th>
<th>Startdatum</th>
<th>Reden</th>
<th>Extra Informatie</th>
</tr>
</thead>
<tbody>
<?php
while ($row = $result->fetch_array()) {
echo "<tr>";
echo "<td>" . $row['notice'] . "</td>";
echo "<td>" . $row['vaarweg'] . "</td>";
echo "<td>" . $row['trajectbeperking'] . "</td>";
echo "<td>" . $row['beperking'] . "</td>";
echo "<td>" . $row['onderwerp'] . "</td>";
echo "<td>" . $row['reden'] . "</td>";
echo "<td>" . $row['periode_chr'] . "</td>";
echo "<td>" . $row['extra_informatie'] . "</td>";
echo "</tr>";
}
?>
</tbody>
</table>