db->select('s.id,s.name,s.year,sub.id as subId,sub.name as subName,dep.id as depId,dep.name as depName,deg.id as degId,deg.name as degName'); $this->db->from('semester as s'); $this->db->join('subject as sub','sub.id=s.subjectId','INNER'); $this->db->join('department as dep','dep.id=s.departmentId','INNER'); $this->db->join('degree as deg','deg.id=s.degreeId','INNER'); $this->db->where(array('s.status'=>1,)); $query = $this->db->get(); //'sub.status'=>1,'dep.status'=>1,'deg.status'=>1 //echo $this->db->last_query();exit; return $query; } function listSubject() { $this->db->select('id,name'); $this->db->from('subject'); $this->db->where(array('status'=>1)); $query = $this->db->get(); //echo $this->db->last_query();exit; return $query; } function listDepartment() { $this->db->select('id,name'); $this->db->from('department'); $this->db->where(array('status'=>1)); $query = $this->db->get(); //echo $this->db->last_query();exit; return $query; } function listDegree() { $this->db->select('id,name'); $this->db->from('degree'); $this->db->where(array('status'=>1)); $query = $this->db->get(); //echo $this->db->last_query();exit; return $query; } function viewSemester($id) { $this->db->select('s.id,s.name,s.year,s.subjectId,dep.id as depId,dep.name as depName,deg.id as degId,deg.name as degName'); $this->db->from('semester as s'); $this->db->join('department as dep','dep.id=s.departmentId','INNER'); $this->db->join('degree as deg','deg.id=s.degreeId','INNER'); $this->db->where(array('s.status'=>1,'s.id'=>$id)); $query = $this->db->get(); //echo $this->db->last_query();exit; return $query; } function getSemester($id) { $this->db->select('*'); $this->db->from('semester'); $this->db->where(array('status'=>1,'id'=>$id)); $query = $this->db->get(); //echo $this->db->last_query();exit; return $query; } function get_subject($id) { $this->db->select('*'); $this->db->from('subject'); $this->db->where(array('status'=>1,'id'=>$id)); $query = $this->db->get(); //echo $this->db->last_query();exit; return $query; } }