I am trying to display a timetable of sorts on my webpage. I need to use PHP to highlight table cells depending on whether they have an entry to the database for todays date. I currently have a table with rooms across the top and times down the side as below:
echo "<table border-1>
<tr>
<th></th>
<th>B-12</th>
<th>G.05</th>
<th>G.06</th>
<th>1.04</th>
<th>1.05</th>
<th>1.06</th>
<th>2.04</th>
<th>2.05</th>
<th>2.06</th>
<th>3.04</th>
<th>3.05</th>
<th>3.06</th>
</tr>
<tr>
<th>9.00</th>
<td></td>
</tr>
<tr>
<th>9.30</th>
<td></td>
</tr>
<tr>
<th>10.00</th>
<td></td>
</tr>
<tr>
<th>10.30</th>
<td></td>
</tr>";
I need to read entries to my database and highlight the corresponding cell, in the correct room column and in the correct time row, based on the entry date, like this
Is there a way to do this in PHP? Am I going about this all wrong? I am new to PHP so am not entirely sure what is the best method to achieve what I need.
I have searched everywhere for a solution to this but have found none that answer my question. If anyone has any idea or could advise me on the best method I would really appreciate it.