php - How to make a Facebook FQL query to select all friends -


i'm new php sdk facebook, sorry if quesiton stupid.

so, have code

select name user     current_location.country = 'italy' ,     uid in (         select uid2 friend uid1 = me()     )  

that responses me:

{   "data": [     {       "name": "matilde xxxx"     },      {       "name": "samson xxxxxxxx"     },       {       "name": "emanuela xxxxxxx"     }   ] } 

i'm using site analyze how manage json :http://chris.photobooks.com/json/default.htm

i saw if want have request of name of friend have that: root.data[5].name

so php code :

$user_id = $facebook->getuser();   $all_friends = $facebook->api(array('method' => 'fql.query', 'query' => 'select name user         current_location.country = "italy" ,         uid in (             select uid2 friend uid1 = 1068943079         ) '));         $val = 1;         echo $all_friends['data'][$val]['name']; 

(is test, want see friend @ key=1) there white page... show nothing.. , if echo $all_friends see array.

sorry if stupid question, know can use method that..but want know how way! thank you, , sorry language.

that code : click here see code

1. should print_r($all_friends) check structure of array

try

echo $all_friends[$val]['name']; 

2. fql query should occur when $user != 0.

place under if statement

3. didn't ask read_friendlists permission

$params = array(   'scope' => 'read_friendlists' );  $loginurl = $facebook->getloginurl($params); 

doc:


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -