开发者

Error in FQLQuery

开发者 https://www.devze.com 2023-04-13 09:40 出处:网络
I have an FQL query: $FQLQuery = \'SELECT uid, sex, pic_square FROM user WHERE uid in (implode(\",\", $man);)\';

I have an FQL query:

$FQLQuery = 'SELECT uid, sex, pic_square FROM user WHERE uid in (implode(",", $man);)';
开发者_运维知识库

$man is an array.

This query is not working, and I am getting an error from Facebook saying "unexpected $ in line 45"

What's wrong with this query?

I tried it with join() also giving me the same error. How can I fix this problem?


Assuming $man is a single dimensional array of Facebook User IDs, it should be:

$FQLQuery = 'SELECT uid, sex, pic_square FROM user WHERE uid in ('.implode(",", $man).')';


I think I got the error, just change that line in your code like

$FQLQuery = "SELECT uid, sex, pic_square FROM user WHERE uid in (implode(',', {$man}))"; 

and it will fix the error. As your $FQLQuery was surrounded by single quote, so $man was not being parsed a variable :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号