2010-05-20 33 views
-7

但是,如果我将时间更改为上午12:00至上午1:00,它会在时间段中呈现,而不是整天的事件?不知道发生了什么事!从上午12:00到上午12:30创建活动时,它显示为全天活动

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); 
mysql_select_db($dbname); 
$query = "select id,class_name,bridge,start_time,end_time from $table"; 
$results= mysql_query($query,$conn); 
$total = mysql_num_rows($results); 

if ($total > 0) { 
    // Start a JSON object called "property" which will be an array of resort properties from around the globe. 
    echo "[" ; 

    $counter = 0; 
    while ($item = mysql_fetch_object($results)) { 

     list($date, $time) = explode(' ', $item->start_time); 
     list($year, $month, $day) = explode('-', $date); 
     list($hour, $minute, $second) = explode(':', $time); 
     $s_timestamp = mktime($hour, $minute, $second, $month, $day, $year); 

     list($date, $time) = explode(' ', $item->end_time); 
     list($year, $month, $day) = explode('-', $date); 
     list($hour1, $minute1, $second) = explode(':', $time); 
     $e_timestamp = mktime($hour1, $minute1, $second, $month, $day, $year); 

     #if ($hour > 0) { 
     #$a_day = 'false'; 
     #} else { 
     #$a_day = 'true'; 
     # } 

     if ($hour == 0 && $hour1 == 0 && $minute == 0 && $minute1 == 0){ 
     $a_day = 'true'; 
     } else { 
     $a_day = 'false'; 
      } 


     echo "{'id':$item->id, 'className':'$item->class_name', 'title':'$item->bridge', 'start':'$s_timestamp', 'end':'$e_timestamp', 'allDay':$a_day}"; 

     $counter++; 

     if ($counter < $total) { echo ", "; } 
    } 

    echo "]"; 
    } 
+4

请添加更多详细信息 - 和密码 – 2010-05-20 14:30:00

+0

感谢Mike,当我去发布我的代码时,我发现导致问题的错误。这个问题出现在我的json.php中......很抱歉浪费板子的时间。 – Kevin 2010-05-20 15:39:05

回答

1

感谢迈克,当我去发布我的代码时,我发现导致问题的错误。这个问题出现在我的json.php中......很抱歉浪费板子的时间。

我需要改变我在设置allday标记时查看小时和分钟的方式。你可以看到我在哪里注释掉了错误的代码。

+1

你仍然可以用更多的细节和错误代码更新你的问题,然后用实际答案编辑你的答案。这将有助于任何遇到同样问题的人。 – 2010-05-20 15:40:48

相关问题