views:

198

answers:

1

Using Twitter OAuth, I'm saving the user's data as JSON in a "twitter" field in my database. Likewise, I'm saving the user's Facebook Connect info (including persistent session_key) as JSON in a "facebook" field.

For most operations, this is great. However, I'd like to add a "Find Friends" function that will grab the user's friends from either service, compare against users on my service, and show the resulting list to suggest friends.

The initial problem: doing a DB call to compare the user's friend list against usernames that are in JSON.

First idea: if I can get a list of all users that have authenticated my application (along with their emails), I could then find users in my database with those emails. However, I'm not aware of any API call for either Twitter or Facebook that does that.

Any other idea on how to create this function?

Thanks in advance.

A: 

You could create tables for the users having their service ID in a field. (facebook or twitter user id).

Then just do a SQL search on the tables to find them. JSON isn't a good idea to store in a table for searching with.

Joe

Joe Simpson

related questions