Complex join in codeigniter -
i hope can help me because brain bleeding right :
to explain :
on website, have table versus. versus vote between 2 images.
the table versus contain 2 field : id_pic1 first pic , id_pic2 second.
each versus linked comments table (id_versus) , users table (id_versus also).
last thing : each pic on each versus link table vote (id_pic,id_versus).
i used utilize cakephp contain made query easy, now, ci, brain stuck on freeze.
if can help leads on general query should make, i'll grateful life.
thanks in advance
edit : here's simplified view of db :
versus id_pic1 id_pic2 id_author
users id
pics id
comments id_versus id_author
vote id_versus id_pic
this how multiple joins done in ci, create according this
$this->db->select('aw.id,awt.title,aw.price,aw.email,aw.is_shop star_shop,aw.video'); $this->db->from('artworks aw'); $this->db->join('artwork_translations awt', 'aw.id = awt.artwork_id'); $this->db->join('languages l', 'l.id = awt.language_id'); $this->db->where('l.code', $language_code); $this->db->where('awt.status', 1); $this->db->where('aw.artist_id', $artist_id); $this->db->order_by('aw.id desc'); $sub_categories = $this->db->get(); homecoming $sub_categories->result();
codeigniter join
No comments:
Post a Comment