我所拥有的是搜索功能。之后,它将提供分页结果。我收到的结果是正确的。但问题是,而不是突出显示的页面是第2页。然后我尝试点击页面1现在它突出显示然后尝试点击第2页它给出了第2页的结果。唯一的问题是当点击搜索按钮时结果突出显示第一页而不是第一页。
<?php
//CONTROLLER
function job_plist(){
if($this->session->userdata('l@ginUs3r')) {
$session_data = $this -> session -> userdata('l@ginUs3r');
$data['u_id'] = $session_data['u_id'];
$data['u_uname'] = $session_data['u_uname'];
$data['u_pword'] = $session_data['u_pword'];
$data['u_role'] = $session_data['u_role'];
$data['is_active'] = $session_data['is_active'];
$data['active'] = "job_plist";
$table="tbl_group";
$select="*";
$orderby="g_name";
$data['ddl1'] = $this -> Main -> dropdown_orderby($select, $table, $orderby);
$table="tbl_division";
$select="*";
$orderby="d_divname";
$data['ddl2'] = $this -> Main -> dropdown_orderby($select, $table, $orderby);
$table="tbl_dept";
$select="*";
$orderby="dept_name";
$data['ddl3'] = $this -> Main -> dropdown_orderby($select, $table, $orderby);
$table="tbl_job_plist";
$select="*";
$orderby="jplist_id";
$data['job_ref'] = $this -> Main -> dropdown_orderby($select, $table, $orderby);
$table = "tbl_job_plist";
$config = array();
$config["base_url"] = base_url() . "personnel/job_plist/";
//$config["total_rows"] = $this -> Main -> count_prf($table);
if(isset($_SESSION['job_list_filter']))
{
$config["total_rows"] = $this -> Main -> count_prf_where($table,$_SESSION['job_list_filter']);
}
else
{
$config["total_rows"] = $this -> Main -> count_prf($table);
}
$config["per_page"] = 10;
$config["uri_segment"] = 3;
$this->pagination->initialize($config);
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
//$data["jplist"] = $this -> Main -> select_job_plist($config["per_page"], $page);
if(isset($_SESSION['job_list_filter']))
{
$data["jplist"] = $this -> Main -> fetch_job_plist($_SESSION['job_list_filter'],$config["per_page"], $page);
}
else
{
$data["jplist"] = $this -> Main -> select_job_plist($config["per_page"], $page);
}
$data["jplist_links"] = $this->pagination->create_links();
if(isset($_POST['search']))
{
if($_POST['division'] != "" && $_POST['group'] != "" && $_POST['department'] != "" && $_POST['position'] != "" )
{
if($_POST['date_rec'] != "" && $_POST['date_upto'] != "")
{
$where = "jplist_div = '".$_POST['division']."' AND jplist_group = '".$_POST['group']."' AND jplist_dept = '".$_POST['department']."' AND jplist_position = '".$_POST['position']."' AND jplist_reg_date BETWEEN '".$_POST['date_rec']."' AND '".$_POST['date_upto']."' ";
}
else
{
$where = "jplist_div = '".$_POST['division']."' AND jplist_group = '".$_POST['group']."' AND jplist_dept = '".$_POST['department']."' AND jplist_position = '".$_POST['position']."' ";
}
$_SESSION['job_list_filter'] = $where;
$config = array();
$config["base_url"] = base_url() . "personnel/job_plist/";
$config["total_rows"] = $this -> Main -> count_prf_where($table,$_SESSION['job_list_filter']);
$config["per_page"] = 10;
$config["uri_segment"] = 3;
$this->pagination->initialize($config);
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
$data["jplist"] = $this -> Main -> fetch_job_plist($_SESSION['job_list_filter'], $config["per_page"], $page);
$data["jplist_links"] = $this->pagination->create_links();
}
$this -> load -> view('templates/header', $data);
$this -> load -> view('pages/job_plist', $data);
$this -> load -> view('templates/footer');
} else {
$this -> load -> view('templates/lheader');
$this -> load -> view('pages/login');
$this -> load -> view('templates/footer');
}
}
?>
然后在视图中我有一个小div来链接,这是
<div class="pagination-align"><?=$prf_links?></div>
答案 0 :(得分:0)
解决方案是我删除了最后一个
$data["jplist_links"] = $this->pagination->create_links();
搜索之后再罚款。