I am trying to achieve the following via Facebook s Multiquery FQL, get a list of all Fan Page Events that i am Attending .
I have the below logic, and have tried to implement something similar with the FQL statement below.
- get list of all events created by / from a Fan Page (using specific id)
- get a list of all my (the users) events attending
- Match eid s from event_member FQL Table
- If they match ids, and rsvp_status is equal to attending
- display result.
FQL Multi
{"query1":"SELECT eid FROM event WHERE eid IN (SELECT eid FROM event_member WHERE uid =$fanpageID)","query2":"SELECT rsvp_status FROM event_member WHERE uid = $uidAND eid IN (SELECT eid FROM #query1)"}
I know the statement is incorrect, but i am struggling on trying to do this. I have achieved this via Graph API using a very messy set of foreach loops in my PHP code.
Using a single multiquery FQL statement would be far more efficient.
Any suggestions would be great.
EDIT
Problem im having now, is ifaour s FQL statement works within the FQL Query console (Returns Results), however when i run the following, and empty array is returned.
When i dissect the statement to just ( SELECT eid FROM event WHERE creator =$fanPageID) the FQL Console highlights that eid in non indexable.
Here is my PHP
function usersEventsPoints($uid, $facebook, $fanpageID){
$events = "SELECT eid FROM event WHERE creator=$fanpageID AND eid
IN (SELECT eid FROM event_member WHERE uid=$uid AND rsvp_status = "attending")";
$eventsAttendance = $facebook->api(array( method => fql.query , query =>$events, )); $eventsAttendingcount = 0;
foreach ($eventsAttendance as $eventsAttendanceFetch) {
if($eventsAttendanceFetch[ eid ] == true){ $eventsAttendingcount++; } } return $eventsAttendingcount; }
Blockquote
Any Ideas?