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

Friend Table

Problem

What’s the schema of the friend table?

Solution

The friend table records the friendship between two users. Its fields are listed in Table 8-7. Queries to this table will only return data the current user is allowed to see (meaning you can’t request friendships for users the current loggedinuser isn’t friends with). More information about this table, including an up-to-date listing of fields, can be found at http://wiki.developers.facebook.com/index.php/Friend_(FQL).

Table 8-7. friend table fields

Name

Type

Index

Description

uid1

int

uid (user ID) of the first user

uid2

int

uid (user ID) of the second user

Discussion

If you’d rather use the API to access friends, try the Friends.get() and the Friends.areFriends() methods.

This table isn’t all that useful on its own, since it contains only two data points, but it is very powerful when combined with the user table (see User Table).

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