1

I was wondering if there is an easy way to get the number of events your friend have created / have been invited. I just need to know how many events there are. I do

$fql = "SELECT name, id, pic FROM profile WHERE id IN (SELECT uid2 FROM friend WHERE uid1 = me() )";
$user_profiles = $facebook->api( array(
        'method' => 'fql.query',
        'query' => $fql,
) );

$fql = array();
// Select '' to minimize xml output
foreach ( $user_profiles as $user ) {
    $id = $user['id'];
    $fql[$id] = "select '' FROM event WHERE eid in (select eid from event_member where uid = $id)";
}
$user_events = $facebook->api( array(
        'method' => 'fql.multiquery',
        'queries' => $fql,
) );

An exception is thrown and the error message is An unknown error occurred. Since i have 1311 friends i'm probably hitting some limits, i tested with only two values (I also tested with 54 and 106 and worked) and had no problems, do you see another way to do this?Do you know what are the limits?

EDIT - the limit is at around 250. But making that number of multiquery seems unreliable, sticking at 200 it's better i think.I stripped down the query to

$fql[$id] = "select '' from event_member where uid = $id LIMIT 1";

So that i only get the fact that the user actually have any invite.

Nicola Peluchetti
  • 76,206
  • 31
  • 145
  • 192

0 Answers0