db->select('s.*,d.name as deptname'); $this->db->from('student as s'); $this->db->join('department as d','d.id=s.department','left' ); $this->db->where(array('s.status'=>1)); $query = $this->db->get(); //echo $this->db->last_query();exit; return $query; } function get_stu($id) { $this->db->select('*'); $this->db->from('student'); $this->db->where(array('status'=>1,'id'=>$id)); $query = $this->db->get(); //echo $this->db->last_query();exit; return $query; } function get_dep() { $this->db->select('*'); $this->db->from('department'); $this->db->where(array('status'=>1)); $query = $this->db->get(); //echo $this->db->last_query();exit; return $query; } }