Php Codeigniter-删除/编辑后显示空数据的分页

Php Codeigniter-删除/编辑后显示空数据的分页,php,codeigniter,Php,Codeigniter,我列出了db的注册员工,每页显示10名员工。我正在使用codeigniter分页 若我在第2页删除了一名员工,删除后我需要转到第2页,显示第2页中的其他员工 视图: 型号: public function deleteemployee($employeeid) { $this->db->where('empID',$employeeid); $this->db->delete('employee');

我列出了db的注册员工,每页显示10名员工。我正在使用codeigniter分页

若我在第2页删除了一名员工,删除后我需要转到第2页,显示第2页中的其他员工

视图:

型号:

public function deleteemployee($employeeid)
         {
             $this->db->where('empID',$employeeid);
        $this->db->delete('employee');
        return $this->db->affected_rows();

    }
 public function getEmployee($limit, $start)
 {
    $this->db->limit($limit, $start);

    $this->db->select()
              ->from('employee')
              ->order_by('emp_fname');

     $this->db->join('service', 'employee.serviceID = service.serviceID','left');
    $query=$this->db->get();

return $query;


 }

  public function employee_count()
   {
      return $this->db->count_all("employee");
   }

但是现在分页链接显示了第一页的链接,即使第二页的内容显示了……

模型方法

public function employee_count()
{
    $result = $this->db->get('employee');
    if ($result->num_rows() > 0) {
        //employee record available 
        return true;
    }
    else
    {
        // employee record not available
        return false; 

    }
}
查看

<?php
     $getData = $this->[your model name]->getEmployee($limit, $start);
?>

<?php if ($getData): ?>
    //Your Pagination Part Here.....
<?php else: ?>
    // else Nothing
<?php endif ?>

//您的分页部分在这里。。。。。
//没有别的了

$page=($this->uri->segment(3))$此->uri->段(3):0是错误的。第三段是您的员工id,不是您的页码。@AdrienXL我编辑了我的代码和内容,但显示了不正确的分页链接。即使删除后显示了第二页的内容,也会显示第一页的分页链接:(
public function employee_count()
{
    $result = $this->db->get('employee');
    if ($result->num_rows() > 0) {
        //employee record available 
        return true;
    }
    else
    {
        // employee record not available
        return false; 

    }
}
<?php
     $getData = $this->[your model name]->getEmployee($limit, $start);
?>

<?php if ($getData): ?>
    //Your Pagination Part Here.....
<?php else: ?>
    // else Nothing
<?php endif ?>