2009-12-19 91 views
0
$status = $facebook->api_client->fql_query("SELECT message,time FROM 
status WHERE uid in (SELECT uid2 FROM friend WHERE uid1=".$user.")"); 

echo "<pre>"; 
print_r($status); 
echo "</pre>"; 

上面的查詢返回所有狀態,我只想要最後2個狀態消息。我只能用fql來做。誰能告訴我它是如何完成的?fql查詢一次 - facebook api

+0

提示:接受答案,如果你喜歡他們 – nisc 2011-12-26 14:49:13

回答

1

您可以指定LIMIT 2以僅返回兩條記錄。

$status = $facebook->api_client->fql_query("SELECT message,time FROM 
status WHERE uid in (SELECT uid2 FROM friend WHERE uid1=".$user.") LIMIT 2"); 

echo "<pre>"; 
print_r($status); 
echo "</pre>"; 

根據你想達到什麼,你可能還需要添加一個ORDER BY。