title: Warning: Illegal string offset in PHP
body: <p>I want to print out the data of users with an inner join but it won't work. The array is filled up correctly in the function and before the <code>foreach</code> but it keeps telling me: </p>
  
  <blockquote>
    <p>Warning: Illegal string offset in PHP</p>
  </blockquote>
  
  <p>THE ARRAY BEFORE THE FOREACH</p>
  
  <pre><code>array (size=6)
    'user_id' =&gt; string '1' (length=1)
    'name' =&gt; string 'Vandenbergh' (length=11)
    'surname' =&gt; string 'Jan' (length=3)
    'avatar' =&gt; string '1394041001.jpg' (length=21)
    'member_id' =&gt; string '21' (length=2)
    'group_id' =&gt; string '18' (length=2)
  </code></pre>
  
  <p>FUNCTION</p>
  
  <pre><code>public function getMembersInfo($group_id)
  {
      var_dump($group_id);
      $db = new Db();
      $select = "SELECT u.user_id, u.name, u.surname, u.avatar, g.member_id, g.user_id, g.group_id FROM tblusers u INNER JOIN tblgroup_member g ON u.user_id = g.user_id WHERE g.group_id=" . $group_id .  "";
  
  //  $result = $db-&gt;conn-&gt;query($select);
      //return $data=$result-&gt;fetch_assoc();
  
      $result = $db-&gt;conn-&gt;query($select);
  
  $result_data = mysqli_fetch_assoc($result);
      var_dump($result_data);
  return $result_data;
  
  }
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>$memberinfo = $group-&gt;getMembersInfo($group_id);
  var_dump($memberinfo);
  
  
   &lt;?php 
          var_dump($memberinfo)   ;
        foreach ($memberinfo as $info) {
              echo "&lt;p&gt;" . $info['name'] . $info['surname'] . "&lt;/p&gt;";
  
        }
  
          ?&gt;
  </code></pre>