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 ?> 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? 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. 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){ 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 ?> Link to comment https://forums.phpfreaks.com/topic/151478-array-error/#findComment-795906 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.