What I am trying to do is to assign a cell from my HTML table to a specific record from my database. I am doing a table with COLSPAN, so it is not the same number of columns in every row. The code for the table is something like this:
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tbody>
<tr>
<td colspan="4">TITLE
</td>
</tr>
<tr>
<td colspan="2">tag1</td>
<td colspan="2">info from database</td>
</tr>
<tr>
<td >tag2</td>
<td>info from database</td>
<td>tag3</td>
<td>info from database</td>
</tr>
</tbody>
</table>
</body>
</html>
This would be the query
$con = new mysqli($servername, $username, $password, $database);
if ($con->connect_error) {
die("Connection failed: " . $con->connect_error);
}
$sql = "SELECT * FROM table WHERE id=id ";
$result = $con->query($sql);
Any help would be great! Thanks