Welcome Guest, Not a member yet? Register   Sign In
Join with 2 tables, foreach problem?
#1

[eluser]8Lou[/eluser]
Hello folks,

whats wrong with my join? the view returns me duplicate images from database, twice the same image
Code:
function getAlbumPhotos()
{
  $this->db->select('album.id, album.alb_titulo, album.alb_evento, album.alb_status, files.fil_path, files.id');
  $this->db->from('album', 'files');
  $this->db->join('files', 'files.fil_album', $this->uri->segment(3));
  $query = $this->db->get();
  return  $query->result();
}




<div id="gallery">
&lt;?php if (isset($records)): foreach($records as $row): ?&gt;
  <div class="thumb">
   <a href="&lt;?php echo base_url(); ?&gt;uploads/&lt;?php echo $row-&gt;fil_path; ?&gt;" rel="facebox">
    <img src="&lt;?php echo base_url(); ?&gt;uploads/thumbnails/&lt;?php echo $row-&gt;fil_path; ?&gt;"/>
   </a>
    
  </div><div><p>&lt;?php echo anchor("album/imgdell/$row->id", "Deletar foto"); ?&gt;</p></div>
&lt;?php endforeach; else: ?&gt;
  <div id="blank_gallery">Nenhuma foto adicionada ao álbum</div>
&lt;?php endif; ?&gt;
<p>&lt;?php echo anchor("album/dellall/$row->id", "Deletar todas fotos"); ?&gt;</p>
</div>

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB