PHP事件日历在实时服务器中不起作用

时间:2014-11-04 07:12:19

标签: php mysql pdo

我使用php-event-calender来显示来自table的事件。当我点击事件日期时,它会在localhost中正确显示相关日期的相关表详细信息。但它没有在实时服务器中显示详细信息。

的index.php

<div id="Calendar"> </div>
<div id="Events"> </div>
<script language="javascript" src="calendar.js"></script>

calender.php

<?php


error_reporting(0);
include("config.php");

/// get current month and year and store them in $cMonth and $cYear variables
(intval($_REQUEST["month"])>0) ? $cMonth = intval($_REQUEST["month"]) : $cMonth = date("m");
(intval($_REQUEST["year"])>0) ? $cYear = intval($_REQUEST["year"]) : $cYear = date("Y");

// generate an array with all dates with events
$sql = "SELECT * FROM reservation WHERE arrival LIKE '".$cYear."-".$cMonth."-%'";
$result = db::getInstance()->query($sql);
while ($row = $result->fetch())  {
    $events[$row["arrival"]]["f_name"] = $row["f_name"];
    $events[$row["arrival"]]["l_name"] = $row["l_name"];
}
// calculate next and prev month and year used for next / prev month navigation links and store them in respective variables
$prev_year = $cYear;
$next_year = $cYear;
$prev_month = intval($cMonth)-1;
$next_month = intval($cMonth)+1;

// if current month is December or January month navigation links have to be updated to point to next / prev years
if ($cMonth == 12 ) {
    $next_month = 1;
    $next_year = $cYear + 1;
} elseif ($cMonth == 1 ) {
    $prev_month = 12;
    $prev_year = $cYear - 1;
}

if ($prev_month<10) $prev_month = '0'.$prev_month;
if ($next_month<10) $next_month = '0'.$next_month;
?>
  <table width="100%" style="width:800px;height:600px;background-color:#FFFFFF;">
  <tr>
      <td class="mNav"><a href="javascript:LoadMonth('<?php echo $prev_month; ?>', '<?php echo $prev_year; ?>')">&lt;&lt;</a></td>
      <td colspan="5" class="cMonth"><?php echo date("F, Y",strtotime($cYear."-".$cMonth."-01")); ?></td>
      <td class="mNav"><a href="javascript:LoadMonth('<?php echo $next_month; ?>', '<?php echo $next_year; ?>')">&gt;&gt;</a></td>
  </tr>
  <tr>
      <td class="wDays">M</td>
      <td class="wDays">T</td>
      <td class="wDays">W</td>
      <td class="wDays">T</td>
      <td class="wDays">F</td>
      <td class="wDays">S</td>
      <td class="wDays">S</td>
  </tr>
<?php 
$first_day_timestamp = mktime(0,0,0,$cMonth,1,$cYear); // time stamp for first day of the month used to calculate 
$maxday = date("t",$first_day_timestamp); // number of days in current month
$thismonth = getdate($first_day_timestamp); // find out which day of the week the first date of the month is
$startday = $thismonth['wday'] - 1; // 0 is for Sunday and as we want week to start on Mon we subtract 1

for ($i=0; $i<($maxday+$startday); $i++) {

    if (($i % 7) == 0 ) echo "<tr>";

    if ($i < $startday) { echo "<td>&nbsp;</td>"; continue; };

    $current_day = $i - $startday + 1;
    if ($current_day<10) $current_day = '0'.$current_day;

// set css class name based on number of events for that day
    if ($events[$cYear."-".$cMonth."-".$current_day]<>'') {
        $css='withevent';
        $click = "onclick=\"LoadEvents('".$cYear."-".$cMonth."-".$current_day."')\"";
    } else {
        $css='noevent';         
        $click = '';
    }

    echo "<td class='".$css."'".$click.">". $current_day . "</td>";

    if (($i % 7) == 6 ) echo "</tr>";
}
?> 
</table>

events.php

<?php


error_reporting(0);
include("config.php");

$sql = "SELECT * FROM reservation WHERE arrival = '".mysql_real_escape_string($_REQUEST["date"])."' AND status='pending'";
$result = db::getInstance()->query($sql);
while ($row = $result->fetch())  {
    echo "<h2>"."Reservation ID :"." ".$row["res_id"]."</h2>";
    echo "<b>"."Client Name :"."</b>"."<span>".$row["f_name"]." ".$row["l_name"]."</span>"."</br>";
    echo "<b>"."Address :"."</b>"."<span>".$row["address"]."</span>"."</br>";
    echo "<b>"."City :"."</b>"."<span>".$row["city"]."</span>"."</br>";
    echo "<b>"."Zip :"."</b>"."<span>".$row["zip"]."</span>"."</br>";
    echo "<b>"."Country :"."</b>"."<span>".$row["country"]."</span>"."</br>";
    echo "<b>"."E-mail :"."</b>"."<span>".$row["email"]."</span>"."</br>";
    echo "<b>"."Contact No :"."</b>"."<span>".$row["contact"]."</span>"."</br>";
    echo "<b>"."In Date :"."</b>"."<span>".$row["arrival"]."</span>"."</br>";
    echo "<b>"."Out Date :"."</b>"."<span>".$row["departure"]."</span>"."</br>";
    echo "<b>"."Total Price :"."</b>"."<span>".$row["tot_price"]."</span>"."</br>";
    echo "<b>"."Room Id :"."</b>"."<span>".$row["room_id"]."</span>"."</br>";
    echo "<b>"."No Of Beds :"."</b>"."<span>".$row["no_beds"]."</span>"."</br>";



}
?>

实时服务器显示日历和事件日期正常。但没有显示该日期的事件详细信息。它在localserver中正确显示。

0 个答案:

没有答案