fql query problem in php
- by yostwal007
I want to fetch the names of users on facebook. For that, I tried using FQL query. The code is,
$result = $facebook->api_client->fql_query("SELECT name FROM user WHERE uid='$user_id');
But there is some problem with this. I guess the query is not getting executed or it is returning null values. I also tried using users.getInfo as follows,
$result = $facebook->api_client->users_getInfo($user_id,'name');
But again, the same problem.
I tried to display the array as,
echo $result['name];
So, I tried both the codes as,
if(!$facebook->api_client->fql_query("SELECT name FROM user WHERE uid='$user_id')) {
echo "Error.";
}
I have included both facebook.php and facebookapi_php5_restlib.php in my php file. Where am i going wrong?