⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Problem with function no return similar values.



josh

josh
  • profile picture
  • Member

Posted 06 August 2014 - 07:52 AM

Hi friends!

This is my code:
function getPhoto($primary_key , $row){
 
 $this->db->select('id_report, path_photo');
 //$this->db->join('report', 'report.id = id_report');
 //$this->db->where('id_report', 'id_report');
 $this->db->from('report r, photo p');
 $where = "p.id_report = r.id AND id_report=".$row->id."";
 $this->db->where($where);
 
 $query = $this->db->get()->result_array();
 
 
  foreach ($query as $row2) {
  
    return " ".$row2['id_report']." - ".$row2['path_photo']."<br>";
   //echo " ".$row2['id_report']." - ".$row2['path_photo']."<br>";
 
 
  }
 
 
 function admin(){
 
   $crud->callback_column('POTHOS', array($this,'getPhoto'));

 .......
I need get from my db the path of my photos but a report can have multiple photos, so I use returns and echo:

(For this case I have the id and url for more explicit)


echo: :)
1407157317858 - a.jpeg
1407157317858 - b.jpeg
1407157633213 - ....
1407177857138 - ....
1407178191268 - ....
1407178583480 - ....
1407179216082 - ....
1407180296732 - ....
1407181835925 - pic1.jpeg
1407181835925 - pic2.jpeg
1407182605509 - .....
1407183065599 - ....
1407183948682 - ....

Return: :wacko:
1407157317858 - a.jpeg (Where is the other photo? b.jpeg)
1407157633213
1407177857138
1407178191268
1407178583480
1407179216082
1407180296732 - pic1.jpeg (pic2.jpeg?)
1407181835925
1407182605509
1407183065599
1407183948682
Please help me, thank you so much :)

josh

josh
  • profile picture
  • Member

Posted 06 August 2014 - 16:19 PM

any ideas?