[eluser]zdknudsen[/eluser]
If I am perceiving this right, I'd go with your first guess. Except there is one things that will make PHP badmouth:
Code:
$this->db->join('categories_gallery', 'categories_gallery.gallery_id'='gallery.id')
Which should just be:
Code:
$this->db->join('categories_gallery', 'categories_gallery.gallery_id = gallery.id')
Otherwise I am fairly sure it is right