Pergunta

Well, I have this code here that is a FQL Query that shows me all attendees of an random event from facebook.

$fql = "SELECT uid FROM event_member WHERE eid = 461462343953933 AND start_time >= now() ORDER BY start_time descLIMIT 50 ";    

$param  =   array(
    'method'    => 'fql.query',
    'query'     => $fql,
    'callback'  => ''
);

$fqlResult   =   $facebook->api($param);


foreach( $fqlResult as $keys => $values ){
    $start_date = date( 'l, F d, Y', $values['start_time'] );
    $start_time = date( 'g:i a', $values['start_time'] );

    echo "<div style='float:left; display:inline;margin-left:4px;'>";
    echo "<a href='https://www.facebook.com/profile.php?id={$values['uid']}' target='_blank'><img src='https://graph.facebook.com/{$values['uid']}/picture'></a></div>";   

}

However, I need to know how to write a query that shows the amount of male attendees and also the amount of attendees were female from random event.

Foi útil?

Solução

The FQL queries are not able to return aggregations. You could use this query

select uid, sex from user where uid in (SELECT uid FROM event_member WHERE eid = 461462343953933 AND start_time >= now() ORDER BY start_time desc) LIMIT 50

and count the resulting gender info yourself in your application.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top