是否可以使用FQL返回满足特定要求的用户的朋友,即返回主修计算机科学的朋友等?这是我用来返回朋友数据的当前FQL查询,如何修改这些以完成此操作,如果没有,那么什么是替代解决方案?
try{
$fql = "select name,education,work from user WHERE uid IN (select uid2 from friend where uid1=($user))";
$param = array(
'method' => 'fql.query',
'query' => $fql,
'callback' => ''
);
$fqlResult = $facebook->api($param);
}
catch(Exception $o){
d($o);
}
}
答案 0 :(得分:0)
不确定这是否有效但是尝试将fql查询添加到这样的内容
select name,education,work from user WHERE uid IN (select uid2 from friend where uid1=($user) AND education.type = "Computer Science"
答案 1 :(得分:0)
我有同样的问题。虽然回答问题已经很晚了,但它会对某些人有所帮助。这就是回答这个问题的原因。
我们必须解析facebook给出的结果集。 Facebook不允许我们检查。
$freinds_list=$facebook->api(array('method'=>'fql.query',
'query'=>"SELECT uid, name, education_history
FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = $user) ORDER BY name"));
$i=0;
foreach($freinds_list as $friend) {
$j=0;
$connection=0;
foreach($friend['education_history'] as $education) {
if(strstr($education['type'],'Computer Science')) {
$user[$i]=$friend['name'];
$i++;
}
$j++;
}
}