getting all post comments under limit using facebook fql query
I have been trying to use Fql query to show all comments for a post.at first i show 2 posts then when 'show more comments' clicked i show next 50 comments,this way it continues.when 'show more comments' i execute following by ajax call to graph api with -
SELECT text,post_id FROM comment WHERE post_id=post_id limit 50
but say when i first click 'show more comments' it shows 52 comments,then when i click again it shows around 102 comments.but for next clicks 152 comments not shown.its stays in around 102 comments.
my target -
1st click to 'show more comments' = show 52 comments starting from first comments(limit value = 52 i specify in query )
2nd click = show 102 comments starting from first comments(limit value=102)
3rd click = show 152 comments starting from first comments(limit value=152) ......continues
so i am not able to achieve this.I really tried many ways using offset too.lots of problems.Are there facebook bugs? kindly help asap.
You should try out cursor pagination, it's recommended as explained at https://developers.facebook.com/docs/reference/api/pagination/
Returned results under cursor paging more consistently match the limit requested, even after hiding any records for which you do not have permissions to view (eg. if you request 10 records, but do not have permissions to see 3 of those records, 3 additional records will be pulled transparently, so that a full 10 records are pulled).
Example with post_id_cursor:
SELECT text, post_id, post_id_cursor FROM comment WHERE post_id='22707976849_10151395520781850' ORDER BY time DESC limit 50
You get the post_id_cursor of the last comment, then navigate next page with >post_id_cursor symbol
SELECT text, post_id, post_id_cursor FROM comment WHERE post_id='22707976849_10151395520781850' AND post_id_cursor>'Mjg3NA==' ORDER BY time DESC limit 50
Example with object_id_cursor is same:
SELECT text, post_id, object_id_cursor FROM comment WHERE object_id='10151395520696850' ORDER BY time DESC limit 50 SELECT text, post_id, time, object_id_cursor FROM comment WHERE object_id='10151395520696850' AND object_id_cursor>'Mjg3NA==' ORDER BY time DESC limit 50
Make sure you enabled "July 2013 Breaking Changes:" field at your app advanced settings, https://developers.facebook.com/apps/YOUR_APP_ID/advanced. More info at https://developers.facebook.com/roadmap
Example of get feed for certain user: