我是 CI 2.0 的新手,当它出现这样的错误时:
Error Number: 1054
Unknown column 'lap_jenis' in 'where clause'
SELECT * FROM ( laporankebijakan
) WHERE lap_type
= 0 AND lap_jenis
= 0 ORDER BY upd_dt
desc LIMIT 10
我的控制器是:
public function posts($lap_type_id=0, $lap_jenis_id=0, $offset = 0) {
if(!$this->session->userdata('login')) {
$this->session->set_flashdata('message', 'Please Relogin.');
redirect('login');
exit;
}
if(!$this->module_auth->read) {
$this->session->set_flashdata('error', $this->module_auth->msg_read);
redirect('warning');
}
$uri_segment = 4;
$num_links = 5;
$limit = 10;
$offset = $this->uri->segment($uri_segment);
$posts = $this->laporan_kebijakan_model->get_paged_list($limit, $offset, $lap_type_id, $lap_jenis_id);
$this->load->library('pagination');
$config['first_url'] = '0';
$config['base_url'] = site_url('kebijakan/posts/'.$lap_type_id);
$config['total_rows'] = $this->laporan_kebijakan_model->count_all($lap_type_id, $lap_jenis_id);
$config['per_page'] = $limit;
$config['uri_segment'] = $uri_segment;
$config['num_links'] = $num_links;
$config['cur_tag_open'] = '<span class="current">';
$config['cur_tag_close'] = '</span>';
$this->pagination->initialize($config);
$data['pagination'] = '<center><div class="pagination">'.$this->pagination->create_links().'</div></center>';
$data['current'] = 'kebijakan';
$data['lap_type_id']= $lap_type_id;
$data['lap_jenis_id']= $lap_jenis_id;
$data['posts'] = $posts;
$this->load->view('vkebijakan_admin',$data);
}
我的模型是:
function get_paged_list($limit = 10, $offset = 0, $jenis=0){
$this->db->where('status', $jenis);
$this->db->order_by('create_date','desc');
return $this->db->get($this->tbl, $limit, $offset)->result();
}
请帮忙