43 lines
937 B
PHP
43 lines
937 B
PHP
<?php
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
class Student_model extends CI_Model {
|
|
|
|
public function __construct() {
|
|
parent::__construct();
|
|
}
|
|
|
|
function list_stu()
|
|
{
|
|
$this->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;
|
|
}
|
|
|
|
}
|