The Facebook method fql.multiquery bothers me.
I try to get all the comments for the post, and then the user information for each of them. I can get comments without any problems, but I am having problems getting users.
I am currently using the following:
FB.api({ method: 'fql.multiquery', queries: { query1: 'SELECT post_fbid, fromid, text, time FROM comment WHERE post_id="'+postID +'"', query2: 'SELECT id, name, url, pic FROM profile WHERE id IN (SELECT fromid FROM #query1)' } }, function(response) { } })
This gives me the following answer:
[ { "name": "query1", "fql_result_set": [ { "post_fbid": "xxxxx", "fromid": user1id, "text": "Here a comment", "time": 1308579931 }, { "post_fbid": "xxxxx", "fromid": user2id, "text": "Another comment", "time": 1308580031 } ] }, { "name": "query2", "fql_result_set": [ { "id": user1id, "name": "User 1 name", "url": "User 1 url", "pic": "User 1 pic" }, { "id": user2id, "name": "User 2 name", "url": "User 2 url", "pic": "User 2 pic" } ] } ]
The problem is that I do not know how to relate this! Therefore, I sort through the comments and want to print the text of each of them with the username next to it. How to do it?
Or is there a better way to do this?
json javascript facebook fql.multiquery
Sharon
source share