[英]error pagination in codeigniter 3
My pagination is work fine, but it's show error when wanting to raise data over existing data For example, show/index/5
or show/index/10
works fine and the data is right. 我的分页工作正常,但是要在现有数据上增加数据时显示错误,例如
show/index/5
或show/index/10
可以正常工作并且数据正确。 But if I go to show/index/120
it shows error 但是如果我去
show/index/120
它显示错误
Invalid argument supplied for foreach()
Here's my controller 这是我的控制器
public function index(){
$config['base_url']=base_url()."book/show/index";
$config['total_rows']= $this->book_model->get_book();
$config['per_page']=5;
$config['num_links'] = 5;
$config['uri_segment']=4;
$config['full_tag_open'] = "<ul class='pagination'>";
$config['full_tag_close'] ="</ul>";
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$config['cur_tag_open'] = "<li class='disabled'><li class='active'><a href='#'>";
$config['first_link']='< Pertama ';
$config['last_link']='Terakhir > ';
$config['next_link']='> ';
$config['prev_link']='< ';
$this->pagination->initialize($config);
$this->load->model('admin/book_model');
$data['book']=$this->book_model->count_book($config);
$this->load->view('admin/book', $data);
}
In your view you have to apply a check in your code 在您看来,您必须在代码中应用检查
if(!empty($result)&& isset($result)){
foreach($results as $data){
----your code--
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.