Page 1 of 1

cannot get calender function to stop writing [SOLVED]

Posted: Sat Nov 26, 2005 9:33 pm
by lcky13
Cannot get calender program to stop writing td cells in last row.
any suggestions?

Code: Select all

if ($week==1)
	{
		echo"<tr>";
		for ($a=0; $a<$firstday; $a++)
		{
		echo "<td> </td>";
		}
		for ($a=$firstday; $a<=$endofweek; $a++)
		{
		echo"<td align=\"top\"><a href=\"http://xxx.xx.xx/~xxx/calender.php?$p='results'&day=$day&month=
		$m&year=$y\">$day</a></td>";
		$day++;
		}
		echo"$firstday <br/>";
		echo"$daysofmonth";
	}
		$week=2;
		echo"</tr>";
	    echo"<tr>";
	[b]	while ($week<=$numweeks)
		{
		for ($a=0; $a<=6; $a++)
		{
		
		echo"<td align=\"top\"><a href=\"http://xxx/~xxx/calender.php?$p='results'&day=$day&month=
		$m&year=$y\">$day</a></td>";
		$day++;
		
		}
		$week++;
		echo"</tr>";
	    }[/b]
HawleyJR:
Please use tags when posting code.
viewtopic.php?t=21171

Posted: Sat Nov 26, 2005 11:13 pm
by Zoxive
Where you getting $numweeks, $endofweek, from what you are showing me, i can't help you, you need to show all of your code.

And whats the point of this?

Code: Select all

while ($week<=$numweeks)
        {
        for ($a=0; $a<=6; $a++)
        {
        
        echo"<td align=\"top\"><a href=\"http://xxx/~xxx/calender.php?$p='results'&day=$day&month=
        $m&year=$y\">$day</a></td>";
        $day++;
        
}
-NSF

Posted: Sat Nov 26, 2005 11:20 pm
by lcky13
figured it out
fixed by adding
for ($a=0; $a<=6&&$day<=$daysofmonth; $a++)