• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Link Relationships in Codeigniter

#1
Star 
i work on open source LMS , in URL 
Code:
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

PHP Code:
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.


Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.