php - Full Calendar Event Data -
php - Full Calendar Event Data -
i'm thinking of using fullcalendar event calendar on website.
my question: there documentation or examples of using php/mysql store access event data?
thanks!
i'm doing too, , had wished there more finish illustration of php/mysql side, since i'm asp.net/ms-sql guy, had spend more time have liked on basic stuff. here's outline of did. it's pretty basic.
first, created table in mysql looks this:
create table `events` ( `id` int(11) not null auto_increment, `title` varchar(200) not null, `start_date` datetime not null, `end_date` datetime not null, `event_url` varchar(200) default null, `all_day` tinyint(1) not null default '0', primary key (`id`) ) engine=myisam default charset=utf8;
then, wrote php programme named json-events.php, used event source calendar. in program, first need start , end dates currently-displayed calendar:
$start_date = $_get['start']; $end_date = $_get['end'];
then, need run sql query events in window:
$sqlcommand = "select * events start_date between from_unixtime($start_date) , from_unixtime($end_date) or end_date between from_unixtime($start_date) , from_unixtime($end_date) order start_date";
then, set array results:
$event_array = array(); while ($record = mysql_fetch_array($result)) { $event_array[] = array( 'id' => $record['id'], 'title' => $record['title'], 'start' => $record['start_date'], 'end' => $record['end_date'], 'url' => $record['event_url'], 'allday' => $record['all_day'] ); }
finally, json encode , echo it:
echo json_encode($event_array);
this seems work. i'm not familiar way date/time fields handled in mysql , php, i'm not sure if i'm doing in efficient manner.
php mysql events calendar fullcalendar
Comments
Post a Comment