I having problem to print out check box according to booth and total days.
Brief story: I have 4 booths, name A1, A2, A3 and A4. I want to let customer booking my booths. Customer can choose which day they want to book.Sometimes the booths available to book for 7 days, sometimes 15 days. Now I want to display my booths according to total days, if booths available for 15 days, then it will display:

if available for 7 days, then it display only 7 checkbox each row.
In my database I store booth, totalDay and D1-D15 as single field.
How to print the above pattern in PHP?
table structure

The general idea is something like this: