Kristen Harrison
Kristen Harrison

Reputation: 61

Error in FQLQuery

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?

Upvotes: 0

Views: 133

Answers (2)

Jeff Sherlock
Jeff Sherlock

Reputation: 3544

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).')';

Upvotes: 3

Hasin Hayder
Hasin Hayder

Reputation: 818

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 :)

Upvotes: 0

Related Questions