Page 1 of 1

PHP array issue: cannot use string offset as an Array

Posted: Tue Dec 08, 2009 5:36 pm
by ReBooker
I get this error only some of the time with a call from an FQL query.
Fatal error: Cannot use string offset as an array

Code: Select all

 
$results = $facebook->api_client->fql_query('Select first_name, pic_big  From user Where uid='.$user.'');
$fname = $results[0]['first_name'];
 
The result array looks like:

Code: Select all

Array
(
    [0] => Array
        (
            [first_name] => Kevin
            [pic_big] => http://profile.ak.fbcdn.net/v226/16/68/ ... 5_6373.jpg
        )
)
 
Any ideas about what the issue would be here?
Thanks,
Kevin

Re: PHP array issue: cannot use string offset as an Array

Posted: Tue Dec 08, 2009 5:43 pm
by AbraCadaver
It probably means that you have no results, so $results is not an array.

Re: PHP array issue: cannot use string offset as an Array

Posted: Tue Dec 08, 2009 6:02 pm
by ReBooker
That would make sense except that I can test the query in Facebook's developer tools and it returns the same results every time. Man, Facebook app development is frustrating.. :x