i'm making table reservations scheduling table with PHP and Mysql. i'm stuck on one thing, dont know how to check every cell i must print,which will indicate a reservation, with every column,which will indicate hours. Can anyone give me an idea ? i will get my reservation info from database same as all tables there are in restaurant. It will look something like this:
<table>
<tbody>
<th>10:00</th>
<th>11:00</th>
<th>12:00</th>
<th>13:00</th>
. . .
<tr>
<td>Table Nr.1</td>
<td>check if 10:00 = reservation_time ...</td>
</tr>
<tr>
<td>Table Nr.2</td>
<td>check if 11:00 = reservation_time ...</td>
</tr>
<tbody>
</table>
i will print working time from database using for loop,because every restaurant has it's own working time. Same goes to Table number. i will loop all tables from database.
It should look something like this in the end : ![84b6b241634099bfed5f100b38135b5c]
i will give you better presentation of what i need.
echo'
<table>
<tbody>
<th>Table/Hours</th>
';
for($i = $start; $i <= $end ; $i++)
{
echo '<th>'.$i.'</th>';
}
while($table = mysqli_fetch_assoc($tables))
{
echo '<tr>
<td>'.$table['ID'].'</td>';
for($i = $start_work_hour; $i <= $end_work_hour; $i++)
{
..database things....
if($reservation_time == $i)
{
echo '
<td colspan="there goes variable with reservation duration time,say,2h" style="background-color: red">
'.$fname.'
'.$lname.'
</td>
';
}
else
{
echo'<td style="background-color: green">FREE</td>';
}
}
echo' </tr>';
}
echo '</tbody>
</table>
';