title: how to combine results of query and return that result using codeigniter
body: <p>i am new with codeigniter.
  i have used the following code to execute query recursively.</p>
  
  <p>Suppose $q query select 4 id (10,11,20,24)</p>
  
  <p>then for each id  showreply function (in foreach) call recursively then how can return the combine result. </p>
  
  <pre><code>$resultq3 = $this-&gt;showreply($reply_id); 
  
      &lt;?php
              public function showreply($reply_id)
              {
  
                     $q1 =$this-&gt;db-&gt;select('*')
                      -&gt;from('forum_reply AS fr')
                  -&gt;where('fr.parent_id',$reply_id1)
                  -&gt;order_by('fr.id ')-&gt;get();;
  
  
                  foreach($q1-&gt;result_array() as $row4)
                  {
                      $id = $row4['id'];  
                      $parent_id = $row4['parent_id'];
                      if($parent_id!=0)
                      {  
                          $this-&gt;showreply($id);                       
  
                      }
                  }
                  return  $result;
              }
           ?&gt;
  </code></pre>