title: Codeigniter return array
body: <p>How to return an array? This is my code (this is inside the model)</p>
  
  <pre><code>function getTeacherSchedule($id){
          $sections = $this-&gt;dbsections-&gt;query('SELECT * FROM sections;');
          foreach ($sections-&gt;result_array() as $section){
              $table = $section['NAME'];
              $tblsection = str_replace(array(' ', '-'),'_', $table);
  
              $schedule = ($this-&gt;dbsections-&gt;query('SELECT * FROM '.$tblsection.' WHERE TEACHER = '.$id));
              $result = $schedule-&gt;result_array();
  
          }
  
          return $result;
      }
  </code></pre>
  
  <p>And I want the result_array() of $schedule to be returned in a controller, but when i try to var_dump() it, it only returns a single record.</p>