带有传递参数的代码点火器分页到where子句链接不起作用
这是我的模特
public function record_count($category) {
return $this->db->where('sub_category_name',$category)->count_all_results("categories_item");
}
public function fetch_departments($category,$limit, $start) {
$this->db->limit($limit, $start);
$query=$this->db->where('sub_category_name',$category)->get("categories_item");
if ($query->num_rows() > 0)
{
foreach ($query->result() as $row)
{
$data[] = $row;
}
return $data;
}
return false;
}
//Here is Controller
public function categories_item()
{
$this->load->database();
$this->load->library('pagination');
$this->load->model('Home_model');
$config = array();
$config["base_url"] = base_url() . "Home/categories_item";
$category=$this->uri->segment(3);
$this->db->where('sub_category_name',$category);
$config['total_rows'] = $this->db->get('categories_item')->num_rows();
$config['use_page_numbers'] = TRUE;
$config["per_page"] = 1;
$config["uri_segment"] = 3;
$this->pagination->initialize($config);
$page = ($this->uri->segment(3)) ? ($this->uri->segment(3)) : 0;
$data["link"] = $this->pagination->create_links();
if( !$data["results"] = $this->Home_model->fetch_departments($category,$config["per_page"], $page))
{
error_reporting(1);
}
else
{
$this->load->view("category_item_list",$data);
}
}