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

Retrieving All Photos a User Is Tagged In

Problem

I need to retrieve all of the photos that a specific user has been tagged in using FQL.

Solution

SELECT pid, src, caption FROM photo WHERE pid IN
 (SELECT pid FROM photo_tag WHERE subject = $user);

Discussion

This will return an empty set if the current loggedinuser doesn’t have permission to see any of the photos or if user hasn’t been tagged in any.

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