Error in FQL Query
-
10-02-2021 - |
Question
This is My Code
$ids = join(", ",$man);
if ( !isset($_SESSION[$appID.'_FQLResult']) ) {
$FQLQuery = "SELECT uid, sex, pic_square FROM user WHERE uid in ($ids)";
$FQLResult = $facebook->api(array( 'method' => 'fql.query', 'query' => $FQLQuery, 'access_token'=>$fbme['access_token'] ));
$_SESSION[$appID.'_FQLResult'] = $FQLResult;
} else {
$FQLResult = $_SESSION[$appID.'_FQLResult'];
}
echo $ids;
echo $FQLResult;
There is an error when i echo $ids it shows the value of $ids but when i echo $FQLResult is shows only "array" written whats wrong in this fql query? how i can fix this? I think there is something wrong in this query $FQLQuery = "SELECT uid, sex, pic_square FROM user WHERE uid in ($ids)";
Solution
- Use
implode()
directly instead ofjoin()
- After a successful API call, you should be expecting an array, so use
print_r($FQLResult);
- Always, if you are not sure of the type of the variable use
var_dump()
- You may want to use the new Graph API end-point (
/fql?q=YOUR_QUERY
), read here - Serialize your array before adding to sessions
- Watch our of the session size limits!
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow