รายละเอียดของการตอบ ::
$today = getdate(time());
while ($d <= $daysInMonth)
{
$s .= "<tr>\n";
for ($i = 0; $i < 7; $i++)
{
$class = ($year == $today["year"] && $month == $today["mon"] && $d == $today["mday"]) ? "calendarToday" : "calendar" ;
if($d >=1 and $d <=31 )
{
$sql="select * from meeting_list where strdate='$year-$month-$d' or enddate='$year-$month-$d' ";
//echo $sql."<br>";
$query=mysql_query($sql);
$result=mysql_fetch_array($query);
}
else
{
$result="";
}
if($result)
{
//$link="";
//$title="";
}
else
{
$link="";
$title="";
}
if($result != "")
{
$bgcolor="19b85d";
}
else if(($i ==0 or $i == 6) && ($d > 0 && $d <= $daysInMonth))
{
$bgcolor="FADCC1";
}
else if($d > 0 && $d <= $daysInMonth)
{
$bgcolor="E0E0E0";
}
else
{
$bgcolor="EEEEEE";
}
$s .= "<td class=\"$class\" align=\"center\" height=\"20\" bgcolor=\"$bgcolor\" title=\"$title\"><font size=\"1\" face=\"Tahoma\"><center>";
if ($d > 0 && $d <= $daysInMonth)
{
$s .= (($link == "") ? $d : "<a style='width: 100px;padding: 0;border: none;height: 12px;float: left;margin: 0;text-align: center;' href=\"$link\">$d</a>");
}
else
{
$s .= "-";
}
$s .= "<center></font></td>\n";
$d++;
}
$s .= "</tr>\n";
}
//else
$s .= "</table>\n";
$s .= "</td>";
$s .= "</tr>";
$s .= "</table>";
return $s;
}
Code (PHP)