PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, March 5, 2022

[FIXED] How to find out the total number of groups created by a user

 March 05, 2022     facebook-fql, facebook-php-sdk     No comments   

Issue

i'm playing with these code and it fails:

$fql = "SELECT name FROM group WHERE gid IN (SELECT name FROM group WHERE version=1) AND creator=me()";
$ret_obj = $facebook->api(array(
     'method' => 'fql.query',
     'query' => $fql,
));
echo count($ret_obj["name"]);

does anyone knows how to count() the no. of groups a person has created. Thanks i'm using PHP-SDK.


Solution

Seems like group table has only 1 field gid as indexable which makes it impossible to filter user groups in FQL. Possible bug.

What you can do is make a graph API call to:

https://graph.facebook.com/me/groups?fields=name,owner  

and then filter results by owner.id and count them.

hope this helps



Answered By - Anatoly Lubarsky
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing