Im trying to create a website to display a booking system's table.
I have a table in mysql database which containing the data like this:
The second column is the post_id. The booking details are provided with the same post_id.
I would like to create an html table which contains the same booking details in one row like this:
<html>
<head>
<title>Booking</title>
<style>
table {
border-collapse: collapse;
width: 100%;
color: #588c7e;
font-family: monospace;
font-size: 25px;
text-align: left;
}
th {
background-color: #588c7e;
color: white;
}
tr:nth-child(even) {background-color: #f2f2f2}
</style>
</head>
<body>
<table>
<tr>
<th>Field14</th>
<th>Field15</th>
<th>Field16</th>
</tr>
<?php
$conn = mysqli_connect("localhost", "admin", "", "test");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT _field_14, _field_15, _field_16 FROM booking";
$result = $conn->query($sql);
?>
</table>
</body>
</html>