D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
ksclnmuac
/
public_html
/
ci_panel
/
application
/
models
/
Filename :
Teacher_model.php
back
Copy
<?php class Teacher_model extends CI_model{ public function get_teacher() { # code... $this->db->select("*"); $this->db->join('tbl_department', 'tbl_department.dept_id=tbl_teacher.dept_id'); $teacher = $this->db->get('tbl_teacher')->result_array(); // echo $this->db->last_query(); return $teacher; } public function add_teacher($formArray) { # code... $this->db->insert('tbl_teacher', $formArray); } public function getTeach($id) { # code... $this->db->where('tech_id', $id); $tech = $this->db->get('tbl_teacher')->result_array(); return $tech; } public function deleteTeacher($id) { # code... $this->db->where('tech_id', $id); $this->db->delete('tbl_teacher'); } public function update_teacher($id, $formArray) { # code... $this->db->where('tech_id', $id); $this->db->update('tbl_teacher', $formArray); } // ==============Models for front-end start=============== // public function teacherFront() { # code... $this->db->join('tbl_department', 'tbl_department.dept_id=tbl_teacher.dept_id'); $this->db->order_by('tech_id', 'desc'); $teachers = $this->db->get('tbl_teacher')->result_array(); return $teachers; } }