fql query problem in php

Posted by yostwal007 on Stack Overflow See other posts from Stack Overflow or by yostwal007
Published on 2010-04-08T05:45:39Z Indexed on 2010/04/08 5:53 UTC
Read the original article Hit count: 489

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?

© Stack Overflow or respective owner

Related posts about facebook-fql

Related posts about fql