简体   繁体   中英

Limiting the Events shown using FQL

I am trying to limit the events shown to only the upcoming events, currently i am getting all events from the page displayed past and present. below is the code:

<?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'];

  ?>

How can this be done?

Use 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM