How can I leave empty cells in a table if I don't want anything to appear in that field? I am sending for some names of some subjects registered in my database, I send for them and they bring them there, there is no problem, the problem is when in a cell if it does not meet the condition that I am telling it to leave the field in blank and put in the corresponding field, EXAMPLE:
In the Monday field it is supposed to be blank, since there is no class at that time, and the Wednesday field also has to be blank, but they do not accommodate
I leave the code here:
<body>
<?php require 'views/navbar.php'; ?>
<div class="contenedor">
<h2>Horario de clases</h2>
<table>
<thead>
<tr>
<th>HORA</th>
<th>LUNES</th>
<th>MARTES</th>
<th>MIERCOLES</th>
<th>JUEVES</th>
<th>VIERNES</th>
</tr>
</thead>
<tr>
<td>8:00 - 9:00</td>
<?php foreach($datos = $conexion->query('SELECT * FROM horario WHERE hora = 8') as $dato){ ?>
<td><?php if(empty($dato)){
echo "Disponible";
}else{
echo $dato ['materia'];
} ?>
</td>
<?php } ?>
</tr>
<tr>
<td>9:00 - 10:00</td>
</tr>
<tr>
<td>10:00 - 11:00</td>
</tr>
<tr>
<td>11:00 - 12:00</td>
</tr>
<tr>
<td>12:00 - 13:00</td>
</tr>
</table>
</div>
Any idea how I can do it? Thank you
Fields of my time table:
It sends me this error: