jeudi 7 mars 2019

Link Relationships in Codeigniter

i work on open source LMS , in URL https://localhost/lms/course/1 when i log into this course , i have sections and content , here is Udemy Course https://ibb.co/gyfd8yG , i want to do the same thing in my project, here is my query

 public function get_course_data($id)
    {
        $this->db->select('*');
        $this->db->from('courses');
        $this->db->join('sections','sections.section_course =courses.course_id ');
        $this->db->join('contents','contents.section_num = sections.section_id');
        $this->db->where('course_id',$id);
        $this->db->order_by('section_num','ASC');
        return $this->db->get()->result_array();
    }

when i do foreach in frontend this query print all queries , my question is how i can specify to print All Contents who linked to the same section id, what is the logical way ?

thanks in advance.




Aucun commentaire:

Enregistrer un commentaire