views:

13

answers:

1

Can I get all the friends's id and their name of a user in an array on a facebook fan page application?

when i use FQL it show cant redeclare the facebook class.

Thanks in advance

A: 

I got the solution Enable a ajax call on first click then in the post page of ajax run this code

<?
include 'facebook.php';
$facebook = new Facebook('APIKEY','APPSECRET');
$user=$_REQUEST['fb_sig_user'];
$query_page="SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = $user)";
$result_frnd = $facebook->api_client->fql_query($query_page);
if($result_frnd)
 {
    $i=0;
    foreach ($result_frnd as $frnd)
      {   
        $allFriend[$i]=$frnd['uid'];
        $i++; 
      }
 }

?>

Enjoy

Abhishek

related questions