I have tried to print multiple JSON data to php but it wont work. This is the code:
$fql = "SELECT uid, name FROM user WHERE uid in (SELECT uid2 FROM friend where uid1 = $user)";
$ret_obj = $facebook->api(array(
'method' => 'fql.query',
'query' => $fql,
));
foreach ($ret_obj as $name) {
$friend = $name->name;
echo "Name: " . $friend . "<br />;
}
I want to display a list of my Facebook friends in the format:
Name: [friend's name]
Name: [friend's name]
Name: [friend's name]
Thanks in advance.
That is an array, not an object, use this:
FQL queries return the results in an array