Facebook查询结果显示

I want to display the result of a query from Facebook in a user-friendly way.

For example, Ii want to display the photo instead of link of it.

Here is my code:

//fql query example using legacy method call and passing parameter

try{
$fql = "select name, hometown_location, sex, pic_square from user where uid=" . $user;
$param = array(
'method' => 'fql.query',
'query' => $fql,
'callback' => ''
);
$fqlResult = $facebook->api($param);

}
catch(Exception $o){
d($o);

}

When I did print_r, the following appears as:

FQL Query Example by calling Legacy API method "fql.query" Array ( [0] => Array ( [name] => Mohamed Abdelrahman [hometown_location] => [sex] => male [pic_square] => http://profile.ak.fbcdn.net/hprofile-ak-prn1/623888_100000415601915_463726603_q.jpg ) )

or when I use:

foreach ($fqlResult as $a => $b)
{

print "$a: $b
";
}

it outputs:

0: Array

thanks for all for your's answers i have solved this myself and here is the soulation

foreach($fqlResult as $inner_arr)
foreach($inner_arr as $value)
echo "$value<br/>";

Please use updated method and code

//run fql query
    $fql_query_url = 'https://graph.facebook.com/'
        . 'fql?q=SELECT+uid2+FROM+friend+WHERE+uid1=me()'
        . '&access_token=' . $access_token;
    $fql_query_result = file_get_contents($fql_query_url);
    $fql_query_obj = json_decode($fql_query_result, true);

You can follow full tutorial at https://developers.facebook.com/docs/technical-guides/fql/

FQL Query Example by calling Legacy API method "fql.query" Array ( [0] => Array ( [name] => Mohamed Abdelrahman [hometown_location] => [sex] => male [pic_square] => http://profile.ak.fbcdn.net/hprofile-ak-prn1/623888_100000415601915_463726603_q.jpg ) )

In your case, $fqlResult is your array. $a is your key [0] and the corresponding value, $b, is the array containing the name, hometown_location, sex, and pic_square.

If you want to display the photo for this $fqlResult, you'll want to set your img src to $b['pic_square']