i use this code to get info about friends
<?php
$fql = "SELECT uid, name, pic_square FROM user WHERE uid = me() OR uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) ";
$fUIDS = $facebook->api(array(
'method' => 'fql.query',
'query' =>$fql,
));
print_r($response);
?>
now i need to show the result in this way
echo '<img src="'.$response['pic_square'].'"/>';
but it did not worked so i did this
$fql = "SELECT pic_square FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) ";
$fPics = $facebook->api(array(
'method' => 'fql.query',
'query' =>$fql,
));
$i=count($fPics);
echo 'Total '.$i.' entries found !<br/>'; // this lines shows 10 as expected :)
for ($x=0;$x<$i;$x++)
echo '<img src="'.$fPIcs[$x].'"/>';
now it shows Array 10 times, what is wrong ?
When PHP prints
Array, that means it tried to turn an array into a string.It is very likely that
$fPicsis an array of arrays, not an array of strings.Try calling
print_r($fPics), I bet you’ll see that each element is actually an array with a single key,pic_square, and a single value — the URL to the image, which is what you want.If so, this means that your loop can be changed to reference that array element: