CodeIgniter の検索ページネーションに問題があります。助けてください。
クエリ条件が多いため、少し長く感じるかもしれませんが、次のページをクリックして 2 ページ目にジャンプします。次の現在のページは 2 ページ目ではありません。お知らせ下さい。
主な問題は、次のページをクリックすると次のページにジャンプしたのに、現在のページが正しく表示されないことです。コントローラ
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->function people_daozhen($askdate,$askdate2,$name,$age,$age2,$phone,$sex,$zxjb,$comefrom,$area){ if(!empty($_POST['askdate'])){ $data ['askdate']=$_POST['askdate']; } if(!empty($_POST['askdate2'])){ $data ['askdate2']=$_POST['askdate2']; } if(!empty($_POST['name'])){ $data ['name']=$_POST['name']; } if(!empty($_POST['age'])){ $data ['age']=$_POST['age']; } if(!empty($_POST['age2'])){ $data ['age2']=$_POST['age2']; } if(!empty($_POST['phone'])){ $data ['phone']=$_POST['phone']; } if(!empty($_POST['sex'])){ $data ['sex']=$_POST['sex']; } if(!empty($_POST['zxjb'])){ $data ['zxjb']=$_POST['zxjb']; } if(!empty($_POST['comefrom'])){ $data ['comefrom']=$_POST['comefrom']; } if(!empty($_POST['area'])){ $data ['area']=$_POST['area']; } $this->load->helper ( 'url' ); $this->load->database(); $this->load->library ( 'pagination' ); $config ['per_page'] = '10'; $config ['base_url'] = base_url(). 'index.php/people/people_daozhen/'.$askdate.'/'.$askdate2.'/'.$name.'/'.$age.'/'.$age2.'/'.$phone.'/'.$sex.'/'.$zxjb.'/'.$comefrom.'/'.$area; $this->load->model ( 'people_mdl','',TRUE ); $data ['datalist'] = $this->people_mdl->people_list2 ( $config ['per_page'], $this->uri->segment ( 13 ) ,$askdate,$askdate2,$name,$age,$age2,$phone,$sex,$zxjb,$comefrom,$area); $config ['total_rows'] =$this->people_mdl->people_sum2($askdate,$askdate2,$name,$age,$age2,$phone,$sex,$zxjb,$comefrom,$area); $config['uri_segment'] = 3; $config ['full_tag_open'] = '<p>'; $config ['full_tag_close'] = '</p>'; $config ['first_link'] = '首页'; $config ['first_tag_open'] = '<li>'; $config ['first_tag_close'] = '</li>'; $config ['last_link'] = '尾页'; $config ['last_tag_open'] = '<li>'; $config ['last_tag_close'] = '</li>'; $config ['next_link'] = '下一页'; $config ['next_tag_open'] = '<li>'; $config ['next_tag_close'] = '</li>'; $config ['prev_link'] = '上一页'; $config ['prev_tag_open'] = '<li>'; $config ['prev_tag_close'] = '</li>'; $config ['cur_tag_open'] = '<li class="current">'; $config ['cur_tag_close'] = '</li>'; $config ['num_tag_open'] = '<li>'; $config ['num_tag_close'] = '</li>'; $this->pagination->initialize ( $config ); $this->load->view ( 'admin/people_daozhen', $data ); }
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> function people_list2($per_nums, $start_position,$askdate,$askdate2,$name,$age,$age2,$phone,$sex,$zxjb,$comefrom,$area){ if($askdate!=0){ $this->db->where('askdate >=',$askdate); } if($askdate2!=0){ $this->db->where('askdate <=',$askdate2); } if($name!=0){ $this->db->like('ユーザー名',$name); } if($age!=0){ $this->db->where('年齢 >=',$age); } if($age2!=0){ $this->db->where('年齢 <=',$age2); } if($phone!=0){ $this->db->like('phone',$phone); } if($sex!=0){ $this->db->where('sex',$sex); } if($zxjb!=0){ $this->db->where('zxjb',$zxjb); } if($comefrom!=0){ $this->db->where('comefrom',$comefrom); } if($エリア!=0){ $this->db->where('エリア',$エリア); } if($askdate!=0){ $this->db->where('askdate >=',$askdate); } $this->db->order_by("pid", "desc"); $query = $this->db->get ($_SESSION['user']->table, $per_nums, $start_position ); $datas['array']=$query->result_array(); $datas['rows']=$query->num_rows(); return $query->result_array(); } function people_sum2($askdate,$askdate2,$name,$age,$age2,$phone,$sex,$zxjb,$comefrom,$area){ if($askdate!=0){ $this->db->where('askdate >=',$askdate); } if($askdate2!=0){ $this->db->where('askdate <=',$askdate2); } if($name!=0){ $this->db->like('ユーザー名',$name); } if($age!=0){ $this->db->where('年齢 >=',$age); } if($age2!=0){ $this->db->where('年齢 <=',$age2); } if($phone!=0){ $this->db->like('phone',$phone); } if($sex!=0){ $this->db->where('sex',$sex); } if($zxjb!=0){ $this->db->where('zxjb',$zxjb); } if($comefrom!=0){ $this->db->where('comefrom',$comefrom); } if($エリア!=0){ $this->db->where('エリア',$エリア); } $query = $this->db->get ($_SESSION['user']->table); $query->num_rows(); を返します。 } <div class="clear"></div>