我正在尝试将显示的事件限制为仅限即将发生的事件,目前我正在显示过去和现在显示的页面中的所有事件。下面是代码:
<?php
date_default_timezone_set('America/Chicago');
$fql = "SELECT eid, name, pic, start_time, end_time, location, description
FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid = XXXXXXXXXXXX )
ORDER BY start_time asc";
$param = array(
'method' => 'fql.query',
'query' => $fql,
'callback' => ''
);
$fqlResult = $facebook->api($param);
foreach( $fqlResult as $keys => $values ){
$sdate = strtotime($values['start_time']);
$edate = strtotime($values['end_time']);
$start_date = date( 'l, m/d', $sdate );
$end_date = date( 'l, m/d', $edate );
if(empty ($edate)){
$edate = $sdate;
}
$start_time = date( 'g A', $sdate );
$end_time = date( 'g A', $edate );
$eventid = $values['eid'];
?>
如何做到这一点?
答案 0 :(得分:1)
使用start_time > now()
。
SELECT eid, name, pic, start_time, end_time, location, description
FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid = xxxxxxxx ) AND start_time > now()
ORDER BY start_time asc