$temp"; } $y_html=""; for ($i=2000;$i<2010;$i++) { if ($year==$i) { $selected=" selected "; } else { $selected=""; } $y_html=$y_html."
$i"; } echo <<< TTT
$pm_html
$m_html
$y_html
$spaces
TTT; echo "
"; echo "
"; echo "
"; echo "
Sun
"; echo "
Mon
"; echo "
Tue
"; echo "
Wed
"; echo "
Thu
"; echo "
Fri
"; echo "
Sat
"; /* Start the table data and make sure the number of days does not exceed the total for the month - $date will always be one more than the total number of days in the momth */ echo "
"; while ($day<$date): /* Figure what day of the week the first falls on and set the number of preceding and trailing cells accordingly */ if ($day == '01') { $off = date('w',mktime(0,0,0,$month,$day,$year)); for ($i=0; $i<$off; $i++) echo "
\n"; $off++; } $sql="select time, name from link where date=\"$year-$month-$day\" and page=3"; $result=mysql_query($sql); $row = mysql_fetch_row($result); $data = substr($row[0],0,5); if ($data=="00:00") $data=""; $data = "$data $row[1]"; echo "
$day
$data
\n"; echo "
"; /* Increment the day and the cells to go before the end of the row and end the row when appropriate */ $day++; $off++; if ($off>7) { echo "
"; $off='01'; } else { echo ""; } endwhile; echo "
"; } ?>