dekeb55 Posted August 7, 2009 Share Posted August 7, 2009 Hi guys, Newbie here and needing help. I was following a video for this php calendar and i don't think i got it right. It keeps telling me line 32,33, 28 has eras but i don't klnow how to fix it. Can anyone help pppplllleeaaaasseee. Here is my calendar php: <?php $date=time(); $day=date('d',$date); $month=date('m',$date); $year=date('y',$date); $first_day=mktime(0,0,0,$month,1,$year); $title=date('F',$first_day); $day_of_week=date('D',$first_day); switch($day_of_week){ case "Sun": $blank = 0; break; case "Mon": $blank = 1; break; case "Tue": $blank = 2; break; case "Wed": $blank = 3; break; case "Thu": $blank = 4; break; case "Fri": $blank = 5; break; case "Sat": $blank = 6; break; } $days_in_month=cal_days_in_month(0,$month,$year); echo"<table border=6 width=394>"; echo"<tr><th colspan=60> $title$year</th></tr>"; echo"<tr><td width=62>S</td><td width=62>M</td><td width=62>T</td><td width=62>W</td><td width=62>T</td> <td width=62>F</td><td width=62>S</td> $day_count=1; echo "<tr>"; while ($blank>0) { echo"<td></td>"; $blank=$blank-1; $day_count++; } $day_num=1; while ($day_num<=$days_in_month) { echo"<td>$day_num</td>"; $day_num++; $day_count++; if ($day_count>7) { echo"</tr><tr>"; $day_count=1; } } while ($day_count>1&&$day_count<-7) { echo"<td></td>"; $day_count++; } echo"</tr></table>"; ?> Can anyone help me with this? Thanks Quote Link to comment Share on other sites More sharing options...
Mardoxx Posted August 7, 2009 Share Posted August 7, 2009 please use code tags Quote Link to comment Share on other sites More sharing options...
dekeb55 Posted August 7, 2009 Author Share Posted August 7, 2009 I don't understand code tags were??? I understand HTML but not php. Quote Link to comment Share on other sites More sharing options...
Mardoxx Posted August 7, 2009 Share Posted August 7, 2009 like this <?php $date=time(); $day=date('d',$date); $month=date('m',$date); $year=date('y',$date); $first_day=mktime(0,0,0,$month,1,$year); $title=date('F',$first_day); $day_of_week=date('D',$first_day); switch($day_of_week){ case "Sun": $blank = 0; break; case "Mon": $blank = 1; break; case "Tue": $blank = 2; break; case "Wed": $blank = 3; break; case "Thu": $blank = 4; break; case "Fri": $blank = 5; break; case "Sat": $blank = 6; break; } $days_in_month=cal_days_in_month(0,$month,$year); echo"<table border=6 width=394>"; echo"<tr><th colspan=60> $title$year</th></tr>"; echo"<tr><td width=62>S</td><td width=62>M</td><td width=62>T</td><td width=62>W</td><td width=62>T</td> <td width=62>F</td><td width=62>S</td> $day_count=1; echo "<tr>"; while ($blank>0) { echo"<td></td>"; $blank=$blank-1; $day_count++; } $day_num=1; while ($day_num<=$days_in_month) { echo"<td>$day_num</td>"; $day_num++; $day_count++; if ($day_count>7) { echo"</tr><tr>"; $day_count=1; } } while ($day_count>1&&$day_count<-7) { echo"<td></td>"; $day_count++; } echo"</tr></table>"; ?> right well echo"<tr><td width=62>S</td><td width=62>M</td><td width=62>T</td><td width=62>W</td><td width=62>T</td> <td width=62>F</td><td width=62>S</td> that echo isn't closed this should work: <?php $date=time(); $day=date('d',$date); $month=date('m',$date); $year=date('y',$date); $first_day=mktime(0,0,0,$month,1,$year); $title=date('F',$first_day); $day_of_week=date('D',$first_day); switch($day_of_week){ case "Sun": $blank = 0; break; case "Mon": $blank = 1; break; case "Tue": $blank = 2; break; case "Wed": $blank = 3; break; case "Thu": $blank = 4; break; case "Fri": $blank = 5; break; case "Sat": $blank = 6; break; } $days_in_month=cal_days_in_month(0,$month,$year); echo"<table border=6 width=394>"; echo"<tr><th colspan=60> $title$year</th></tr>"; echo"<tr><td width=62>S</td><td width=62>M</td><td width=62>T</td><td width=62>W</td><td width=62>T</td> <td width=62>F</td><td width=62>S</td>"; $day_count=1; echo "<tr>"; while ($blank>0) { echo"<td></td>"; $blank=$blank-1; $day_count++; } $day_num=1; while ($day_num<=$days_in_month) { echo"<td>$day_num</td>"; $day_num++; $day_count++; if ($day_count>7) { echo"</tr><tr>"; $day_count=1; } } while ($day_count>1&&$day_count<-7) { echo"<td></td>"; $day_count++; } echo"</tr></table>"; ?> //edit yup it does you were nearly there all you missed was a "; at the end of line 31 keep it up! Quote Link to comment Share on other sites More sharing options...
dekeb55 Posted August 8, 2009 Author Share Posted August 8, 2009 Thank You so very much. I am not so anymore. And again Thank You. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.