Domanda

Here is the sample code I have used when I get the script to display all the groups I am a member of facebook. How can I make it so it only shows the groups that contain the word "blog"?

$fql_query = 'select gid, name from group where gid IN (SELECT gid FROM group_member WHERE uid='.$fbuser.')';
$postResults = $facebook->api(array( 'method' => 'fql.query', 'query' => $fql_query ));

foreach ($postResults as $postResult) {
   echo '<br><option value="'.$postResult["gid"].'">'.$postResult["name"].'</option>';
}
È stato utile?

Soluzione

There's no LIKE operator in fql, but you can use IN operator as-

select gid, name from group 
where gid IN 
  (SELECT gid FROM group_member WHERE uid='.$fbuser.') 
  AND strpos(lower(name), lower("Test")) >= 0
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top