我是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();
}
请帮助
答案 0 :(得分:4)
似乎你的桌子“laporankebijakan”没有像“lap_jenis”这样的专栏。在该表中创建名为“lap_jenis”的列。希望错误能够得到解决。
答案 1 :(得分:0)
您的表'laporankebijakan'可能没有名为'lap_jenis'的列。检查您的表格并仔细检查列名称。