Here's what I want to do. I have a variable called $rowCount that keeps track of how many total cells have been added to a table. Its actually the month view of a calendar. I need to print blank cells representing the days of the next month to fill in the cells and make the grid complete. I am almost there, I just need to figure out how to make it stop printing new cells when the $rowCount variable becomes divisible by 7. That would mean that all table rows have 7 columns, and the grid is complete.
here is what I tried so far, but this just keeps printing the cells, never stopping.
if ($rowCount % 7 != 0){
do {print "<td height=45 valign=\"top\" bgcolor=#E5E5E5> </td>\n";
}
while ($rowCount % 7 != 0);
}
when I put this:
print $rowCount % 7;
, right before the above statement, it returns a 0 on a month like November which has cells going all the way to end of the week (saturday). It doesn't need to have any extra cells created. but when I go to December, the result prints as 2, which is not equal to 0, so it should print extra cells until it has printed the cell that finally makes the $rowCount variable divisible by 7.
Any help would be greatly appreciated.