O'Reilly logo

Facebook Cookbook by Jay Goldman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

App Friends

Problem

I need to find all of the friends of a specific user who have already installed my application.

Solution

SELECT uid FROM user WHERE has_added_app = 1 AND uid IN (SELECT
 uid2 FROM friend WHERE uid1 = $user);

Discussion

This particularly comes in handy when you’re displaying an fb:multi-friend-selector control in FBML and want to exclude friends of the current loggedinuser who have already installed your app (see Invitations and Requests).

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required