線上書籍

Home

[1042] XOOPS模組開發進階

<?php include "../../mainfile.php"; $start = date("Y-m-d" , $_REQUEST['start']/1000); $end = date("Y-m-d" , $_REQUEST['end']/1000); $sql = "select sn, birthday, name from `" . $xoopsDB->prefix("phone_book") . "` where birthday >= '{$start}' and birthday < '{$end}'"; $result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error()); $i=0; while (list($sn ,$birthday ,$name) = $xoopsDB->fetchRow($result)) { $myEvents[$i]['title'] = $name; $myEvents[$i]['start'] = $birthday; $myEvents[$i]['url'] = "index.php?sn={$sn}"; $myEvents[$i]['color'] = 'red'; $i++; } // $myEvents[0]['title'] = '開始'; // $myEvents[0]['start'] = $start; // $myEvents[1]['title'] = '今天'; // $myEvents[1]['start'] = '2015-10-24'; // $myEvents[2]['title'] = '結束'.$end; // $myEvents[2]['start'] = '2015-10-31'; echo json_encode($myEvents);