有没有办法将 SQL 与 FQL(Facebook 查询语言)结合起来

发布于 11-15 19:42 字数 1088 浏览 3 评论 0原文

有没有办法将 SQL 与 FQL 结合起来。 我说的是 FQL 多重查询之类的东西。

这是我的示例代码。

//这里我从SQL数据库中获取数据

$result_user_pages = mysql_query("SELECT Page_ID FROM user_fanpage WHERE User_ID='$uid'");

while($row = mysql_fetch_array($result_user_pages))
{
     $user_page_ID[$m]    = $row['Page_ID'] ;
     $m++;
}

//这里我将'$user_page_ID'数组传递到for循环中并调用facebook api

for ($i=0; $i $query1 = "从流中选择 post_id WHERE source_id='$user_page_ID[$i]'"; $query2 = "SELECT fromid,来自评论的文本 WHERE post_id IN (SELECT post_id FROM #query1)";

    $queries        =   '{
                           "query1": "' . $query1 . '",
                           "query2": "' . $query2 . '"
                         }';
    $attachment = array("method"=>"fql.multiquery","queries"=>$queries,'access_token'=>$access_token);
    $ret_code = $facebook->api($attachment); 

如果 '$user_page_ID' 有 10 个元素,则 api 被调用 10 次。因此

有时它会给我一条连接超时错误消息。如果有办法将 sql 查询与 fql 结合起来(如 fql 多重查询),我可以避免此错误信息。 谁能告诉我是否有办法做到这一点或任何其他解决方案......?

Is there a way to combine SQL with FQL.
I am talking about something like FQL multiqueries.

This is my sample code.

//Here I take data from a SQL database

$result_user_pages = mysql_query("SELECT Page_ID FROM user_fanpage WHERE User_ID='$uid'");

while($row = mysql_fetch_array($result_user_pages))
{
     $user_page_ID[$m]    = $row['Page_ID'] ;
     $m++;
}

//Here I pass '$user_page_ID' array into a for loop and call facebook api

for ($i=0; $i
$query1 = "SELECT post_id FROM stream WHERE source_id='$user_page_ID[$i]'";
$query2 = "SELECT fromid,text from comment WHERE post_id IN (SELECT post_id FROM #query1)";

    $queries        =   '{
                           "query1": "' . $query1 . '",
                           "query2": "' . $query2 . '"
                         }';
    $attachment = array("method"=>"fql.multiquery","queries"=>$queries,'access_token'=>$access_token);
    $ret_code = $facebook->api($attachment); 

}

If '$user_page_ID' has 10 elements, api is called 10 times.Therefore sometime it gives me a connection time out error message.If there is a away to combine sql query with fql(like fql multiqueries), I can avoid this error message.
Can any one tell me whether there is a way to do this or any other solution...??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

披肩女神2024-11-22 19:42:14

由于现有的限制,你不能这样做

You cannot do that with the restrictions that are in place

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文