Jump to content

array error


l0ve2hat3

Recommended Posts

using PHP5 i get this error but using PHP4 it works fine..

 

Fatal error: Cannot use string offset as an array in /home/user/public_html/test/sign_up.php on line 93

 

<?php
$net = $facebook->api_client->fql_query("SELECT  affiliations FROM user WHERE uid ='$id' "); //line 92
$network = $net[0]['affiliations'];// line 93

foreach($network as $info){//line 95
?>

 

Link to comment
https://forums.phpfreaks.com/topic/151478-array-error/
Share on other sites

network was not a array till you added [] to net work there fore foreach willl error out

<?php
$net = $facebook->api_client->fql_query("SELECT  affiliations FROM user WHERE uid ='$id' "); //line 92
$network[] = $net[0]['affiliations'];// line 93

foreach($network as $info){//line 95
?>

Link to comment
https://forums.phpfreaks.com/topic/151478-array-error/#findComment-795906
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.