|
|
|
รบกวนช่วยดู ปฎิทินกิจกรรรมหน่อยครับ ข้อมูลไม่ขึ้นครับ |
|
|
|
|
|
|
|
ผมกรอกข้อมูลลงไปในวันที่ 4,5,6 ซึ่งวันที่ 5 เป็นวันปัจจุบันที่มีข้อมูล แต่ข้อมูลไม่แสดงครับ
Code (PHP)
<?php
//print $_GET["id"];
$monthNames = Array("มกราคม", "กุมภาพันธ์", "มีนาคม", "เมษายน", "พฤษภาคม", "มิถุนายน", "กรกฎาคม", "สิงหาคม", "กันยายน", "ตุลาคม", "พฤศจิกายน", "ธันวาคม");
?>
<?php
if (!isset($_REQUEST["month"])) $_REQUEST["month"] = date("n");
if (!isset($_REQUEST["year"])) $_REQUEST["year"] = date("Y");
?>
<?php
$cMonth = $_REQUEST["month"];
$cYear = $_REQUEST["year"];
$prev_year = $cYear;
$next_year = $cYear;
$prev_month = $cMonth-1;
$next_month = $cMonth+1;
if ($prev_month == 0 ) {
$prev_month = 12;
$prev_year = $cYear - 1;
}
if ($next_month == 13 ) {
$next_month = 1;
$next_year = $cYear + 1;
}
$date_now = date("d");
$month_now = date("n");
$year_now = date("Y");
$timeStampNow = mktime(0, 0, 0, $month_now, $date_now , $year_now);
$sSqlCalendar = "SELECT event_date,event_id,event_name FROM tbl_event WHERE event_month=" . $cMonth . " AND event_year=" . $cYear;
$sSqlCalendar .= " ORDER BY event_date ASC";
$conn = new connectDB;
$arrCalendar = $conn->return_sql($sSqlCalendar);
$recCountCalendar = $conn->record_count($sSqlCalendar);
//print $recCountCalendar;
?>
<table width="100%" border="0" cellpadding="1" cellspacing="1">
<tr>
<td align="center">
<table width="100%" border="0" cellpadding="2" cellspacing="2">
<tr>
<td align="left" bgcolor="#ccc"> <a href="<?php print $_SERVER["PHP_SELF"] . "?id=" . $id . "&month=". $prev_month . "&year=" . $prev_year; ?>" style="color:#000"><</a></td>
<td colspan="5" bgcolor="#ccc" style="color:#000" align="center">
<strong><?php print $monthNames[$cMonth-1].' '.$cYear; ?></strong>
</td>
<td align="right" bgcolor="#ccc"><a href="<?php print $_SERVER["PHP_SELF"] . "?id=" . $id . "&month=". $next_month . "&year=" . $next_year; ?>" style="color:#000">></a> </td>
</tr>
<tr>
<td align="center" bgcolor="#ccc" style="color:#000"><strong>อา.</strong></td>
<td align="center" bgcolor="#ccc" style="color:#000"><strong>จ.</strong></td>
<td align="center" bgcolor="#ccc" style="color:#000"><strong>อ.</strong></td>
<td align="center" bgcolor="#ccc" style="color:#000"><strong>พ</strong></td>
<td align="center" bgcolor="#ccc" style="color:#000"><strong>พฤ.</strong></td>
<td align="center" bgcolor="#ccc" style="color:#000"><strong>ศ</strong></td>
<td align="center" bgcolor="#ccc" style="color:#000"><strong>ส</strong></td>
</tr>
<?php
$timestamp = mktime(0,0,0,$cMonth,1,$cYear);
$maxday = date("t",$timestamp);
$thismonth = getdate ($timestamp);
$startday = $thismonth['wday'];
for ($i=0; $i<($maxday+$startday); $i++) {
$timeStampCalendar = mktime(0, 0, 0, $cMonth , ($i - $startday + 1) , $cYear);
//print $cMonth;
//print $month_now;
if(($i % 7) == 0 ) print "<tr>";
if($i < $startday){
print "<td></td>";
}else{
if($date_now == ($i - $startday + 1) and ($cMonth==$month_now) and ($cYear == $year_now)){
print "<td align='center' valign='middle' height='20px' style=\"height:50px;background-color:#33CC00;\"><strong>". ($i - $startday + 1) . "</strong></td>";
}else{
//กรณีที่ต้องการแสดงทุกวันกำหนด ให้ $timeStampNow=0;
$timeStampNow=0;
if($timeStampCalendar > $timeStampNow){
//วันที่ยังไม่ถึง
$calendar_check=0;
for($iiLoop=0;$iiLoop<$recCountCalendar;$iiLoop++){
if($arrCalendar[$iiLoop][0]==($i - $startday + 1)){
$calendar_check = 1;
break;
}else{
$calendar_check=0;
}
}
if($calendar_check==1){
print "<td align='center' valign='middle' height='100px' style=\"background-color:#ccc;\">";
print ($i - $startday + 1);
print "<br /><br />";
for($iiLoop=0;$iiLoop<$recCountCalendar;$iiLoop++){
if($arrCalendar[$iiLoop][0]==($i - $startday + 1)){
print "<div align=\"left\">";
print "<a href=\"calendar_detail.php?event_id=" . $arrCalendar[$iiLoop][1] . "&lightbox[width]=500&lightbox[height]=428\" target=\"_parent\" class=\"lightbox\">";
print $arrCalendar[$iiLoop][2];
print "</a>";
print "</div>";
}
}
//print "<a href=\"content_view.php?cat=c&event_id=" . $arrCalendar[$iiLoop][1] . "\" target=\"_parent\">". ($i - $startday + 1) . "</a>";
print "</td>";
}else{
print "<td align='center' valign='middle' height='20px' style=\"height:100px;background-color:#ccc;\">". ($i - $startday + 1) . "</td>";
}
}else{
print "<td align='center' valign='middle' height='20px' style=\"height:100px;background-color:#ccc;\">". ($i - $startday + 1) . "</td>";
}
}
}
if(($i % 7) == 6 ) print "</tr>";
}
?>
</table>
</td>
</tr>
</table>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2014-06-05 14:57:10 |
By :
puldool |
View :
682 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|