However if I change the time to 12:00am to 1:00am, it renders in the time slot and not as an all day event? Not sure whats going on!
$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 "]";
}
Thanks Mike, when I went to post my code I notice the bug causing the problem. The issue was in my json.php.... sorry to waste the boards time.
I needed to change the way I was looking at my hours and minutes when setting the allday tag. You can see where I commented out the bad code.
精彩评论