l0ve2hat3 Posted March 28, 2009 Share Posted March 28, 2009 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 ?> Quote Link to comment https://forums.phpfreaks.com/topic/151478-array-error/ Share on other sites More sharing options...
Philip Posted March 28, 2009 Share Posted March 28, 2009 Are you using the variable $network anywhere else in the script? Quote Link to comment https://forums.phpfreaks.com/topic/151478-array-error/#findComment-795656 Share on other sites More sharing options...
l0ve2hat3 Posted March 28, 2009 Author Share Posted March 28, 2009 nope not at all. Quote Link to comment https://forums.phpfreaks.com/topic/151478-array-error/#findComment-795858 Share on other sites More sharing options...
Philip Posted March 28, 2009 Share Posted March 28, 2009 Hmm... Try: $net = $facebook->api_client->fql_query("SELECT affiliations FROM user WHERE uid ='$id' "); $network = array(); $network = $net[0]['affiliations']; foreach($network as $info){ Quote Link to comment https://forums.phpfreaks.com/topic/151478-array-error/#findComment-795869 Share on other sites More sharing options...
redarrow Posted March 28, 2009 Share Posted March 28, 2009 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 ?> Quote Link to comment https://forums.phpfreaks.com/topic/151478-array-error/#findComment-795906 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.