This is my model:
function getGalleryListing()
{
$this->db->select('photo.id,photo.src,photo.title,photo.user_id,users.id,users.username');
$this->db->from('photo');
$this->db->join('users', 'users.id = photo.user_id');
$query = $this->db->get();
return $query->result();
}
And my controller:
function index()
{
$data['gallery_list'] = $this->Gallery_model->getGalleryListing();
$data['content'] = $this->load->view('gallery/index', $data, true);
if ($this->dx_auth->is_logged_in())
{
$this->load->view('template_login', $data);
}
else
{
$this->load->view('template', $data);
}
}
The problem is, when I do <?= $gallery->id ?>
, it keeps showing me the ID from USERS.ID instead of PHOTO.ID. Did I miss out something? Thanks for any help.