cannot get calender function to stop writing [SOLVED]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lcky13
Forum Newbie
Posts: 8
Joined: Sat Nov 26, 2005 9:28 pm

cannot get calender function to stop writing [SOLVED]

Post 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
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Post 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
lcky13
Forum Newbie
Posts: 8
Joined: Sat Nov 26, 2005 9:28 pm

Post by lcky13 »

figured it out
fixed by adding
for ($a=0; $a<=6&&$day<=$daysofmonth; $a++)
Post Reply