I have a simple php script that creates a monthly calendar using a for loop. I want to display an appointment time (which comes from the database) for all the days of that month if an appointment exists for that day.
I was thinking of doing something like this:
while($day <=31)
{
echo '<td>'
select time from appointments where day = $day;
execute query
if number of rows returned > 0 print out the appointment time
echo '</td>'
}
Is there a better way to do this rather then executing a query every iteration?