/    Sign up×
Community /Pin to ProfileBookmark

Cannot use string offset as an array – Error

Hi, I’m getting the error: “Cannot use string offset as an array” for this code, if someone has a minute to take a look at this.

[CODE] $user_details = $facebook->api_client->users_getInfo($authData[“uid”], ‘first_name,last_name,pic_square,email’);
$data[‘first_name’] = $user_details[0][‘first_name’];
$data[‘last_name’] = $user_details[0][‘last_name’];
$data[‘pic’] = $user_details[0][‘pic_square’];
$data[’email’] = $user_details[0][’email’];
$data[‘uid’] = ‘FB_’.$user_details[0][‘uid’];

easyRegister($data[‘uid’],$data[‘first_name’],$data[‘last_name’],$data[’email’]);[/CODE]

Thank you

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJan 27.2011 — Which line is failing? Is there any other info in the error message? (You might want to just copy and paste the whole error message here.)
Copy linkTweet thisAlerts:
@theflyingminstauthorJan 27.2011 — Hi, thanks. The error is triggered by this line (73):

[CODE]$data['first_name'] = $user_details[0]['first_name'];[/CODE]
Copy linkTweet thisAlerts:
@NogDogJan 27.2011 — My best guess is that $user_details is not an array. You could check by doing a var_dump($user_details) to see what its type and value is. If it is not an array, then you need to work back to where it gets defined/set and figure out what went wrong.
Copy linkTweet thisAlerts:
@theflyingminstauthorJan 27.2011 — Ok, cool great idea. Thanks!
×

Success!

Help @theflyingminst spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...