<?php
$root_pass="12345"; //資料庫root密碼
$db_name="test"; //資料庫名稱
/* 連資料庫檢查 */
$link=mysql_connect("localhost","root",$root_pass); //資料庫連線
mysql_query("SET NAMES 'utf8'"); //設定語系
echo get_event();
//取得事件
function get_event(){
GLOBAL $db_name;
$start=date("Y-m-d",$_REQUEST['start']/1000);
$end=date("Y-m-d",$_REQUEST['end']/1000);
$sql="select * from calender where date >= '$start' and date <= '$end'";
$result=mysql_db_query($db_name,$sql) or die($sql);
$i=0;
while(list($sn,$date,$event)=mysql_fetch_row($result)){
$myEvents[$i]['id']=$sn;
$myEvents[$i]['title']=$event;
$myEvents[$i]['start']=strtotime($date);
$i++;
}
return json_encode($myEvents);
}
?>