2
I am creating a small table that has 7 columns, the first row of each column represents a day and the remaining are times of that day.
I want the times that are stored in the bank to be highlighted in this table. I tried a few ways, I didn’t succeed and I’d like a little help.
Here’s the code, and I apologize for any basic mistake, I’m still not very familiar with PHP.
<table border="1">
<?php
$query = array();
echo '<tr>';
for ($i = 1; $i <= 7; $i++) {
$data = date('d-m-Y',strtotime('+' . $i . ' days'));
$query[$i] = mysql_query ("SELECT hora_consulta FROM consulta WHERE data_consulta = '$data'");
echo '<td>' . $data . '</td>';
}
echo '</tr>';
$horario = '08:00';
while (strtotime($horario) < strtotime('20:00')) {
echo '<tr>';
echo '<td>' . $horario . '</td>' .
'<td>' . $horario . '</td>' .
'<td>' . $horario . '</td>' .
'<td>' . $horario . '</td>' .
'<td>' . $horario . '</td>' .
'<td>' . $horario . '</td>' .
'<td>' . $horario . '</td>' ;
$horario = strtotime("$horario + 30 minutes");
$horario = date("H:i",$horario);
echo '</tr>';
}
?>
</table>
Exactly what I needed, thank you so much for your help!
– Adolfo