FQL Snippets

From Facebook Developer Wiki

Revision as of 01:05, 4 April 2009 by Ryan Fanshaw (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

For information on how these are accomplished, see the FQL Documentation. Please add your own snippets and help others.


All lists are assumed to be comma-delimited. To get an array into this form, use the following snippet (in PHP):

$userlist = implode(',', $userarray);

Select friends of $user:

"SELECT uid1 FROM friend WHERE uid2=$user"

Select users from $userlist that share a group with $user:

This only works with the uids in $userlist that are friends with $user

"SELECT uid FROM group_member WHERE uid IN($userlist) AND gid IN(SELECT gid FROM group_member WHERE uid=$user)"
reference