I’m trying to setup a multiquery in FQL in PHP, with a variable. But I can’t seem to get it to work correctly
$fql = '{
"uid" : "SELECT uid FROM user WHERE username = \"$friend\"",
"album": "SELECT object_id, link, aid, cover_pid, location, name FROM album WHERE owner IN (SELECT uid FROM #uid)",
"photo": "SELECT src FROM photo WHERE pid IN (SELECT cover_pid FROM #album)"
}';
This is basically trying to get the cover photos of your friends album.
If I put in a friend’s username directly in place of $friend, I get all the results, but not with the above code where $friend is dynamically set.
What went wrong!!??
Thanks
Strings using single quotes are not evaluated by PHP. In this case you should concatenate them using the dot operator:
You should take a look at the “PHP bible”.