I’m creating a model, and am wondering if this the correct syntax for a join, with a where, and an orderby.
$this->db->select('*');
$this->db->from('gallery');
$this->db->join('categories_gallery', 'categories_gallery.gallery_id'='gallery.id');
$this->db->where('categories_id', $this->input->post('category_id');
$this->db->orderby('display_order');
$this->db->get();
or is it this:
$this->db->select('*');
$this->db->from('gallery');
$this->db->join('categories_gallery', 'categories_gallery.gallery_id'='gallery.id');
$this->db->join('categories_gallery.categories_id'=$this->input->post('category_id');
$this->db->orderby('display_order');
$this->db->get();
