title: How do I return an array all values with the same id?
body: <p>This is my code:</p>
  
  <pre><code>function getPhoto($primary_key , $row){
  
     $this-&gt;db-&gt;select('id_report, path_photo');
     //$this-&gt;db-&gt;join('report', 'report.id = id_report');
     //$this-&gt;db-&gt;where('id_report', 'id_report');
     $this-&gt;db-&gt;from('report r, photo p');
     $where = "p.id_report = r.id AND id_report=".$row-&gt;id."";
     $this-&gt;db-&gt;where($where);
     $query = $this-&gt;db-&gt;get()-&gt;result_array();
  
  
    foreach ($query as $row2) {
  
       return " ".$row2['id_report']." - ".$row2['path_photo']."&lt;br&gt;";
       //echo " ".$row2['id_report']." - ".$row2['path_photo']."&lt;br&gt;";
  
  
  }
  
  function admin(){
  
        $crud-&gt;callback_column('POTHOS', array($this,'getPhoto')); 
  
  .......
  </code></pre>
  
  <p>I need get from my db the path of my photos but a report can have multiple photos, so I use returns and echo:</p>
  
  <p>(For this case I have the id and url for more explicit)</p>
  
  <p>echo:</p>
  
  <pre><code>1 - a.jpeg
  1 - b.jpeg
  2 - ....
  3 - ....
  4 - ....
  5 - ....
  6 - ....
  7 - ....
  8 - pic1.jpeg
  8 - pic2.jpeg
  9 - .....
  10 - ....
  </code></pre>
  
  <p>return:</p>
  
  <pre><code>1 - b.jpeg (Where is the other photo? a.jpeg)
  2 - ......
  3 - .....
  4 - .....
  5 - .....
  6 - .....
  7 - .....
  8 - pic2.jpeg (pic1.jpeg?)
  9 - .....
  10 - .....
  </code></pre>