CodeIgniter Search Page A bit of a problem, help to see
My query conditions are more, so it may seem a little bit longer, paging is available, but click on the next page, jump to the second page, the following page is not the second page! Please advise.
The main problem is that when you click on the next page, you have jumped to the next page, but the current page is not displayed correctly! Controller
PHP Code
function People_daozhen ($askdate, $askdate 2, $name, $age, $age 2, $phone, $sex, $ZXJB, $comefrom, $area) { if (!empty ($_post[' askdate ')) {$data [' askdate ']=$_post[' askda Te ']; } 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. ' /'. $askdate 2. ' /'. $name. ' /'. $age. ' /'. $age 2. ' /'. $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, $askdate 2, $name, $age, $age 2, $phone, $sex, $ZXJB, $comefrom, $area); $config [' total_rows '] = $this->people_mdl->people_sum2 ($askdate, $askdate 2, $name, $age, $age 2, $phone, $sex, $ ZXJB, $comefrom, $area); $config [' uri_segment '] = 3; $config [' full_tag_open '] = ''; $config [' full_tag_close '] = '
'; $config [' first_link '] = ' home '; $config [' first_tag_open '] = '
'; $config [' first_tag_close '] = ''; $config [' last_link '] = ' last '; $config [' last_tag_open '] = '
'; $config [' last_tag_close '] = ''; $config [' next_link '] = ' next page '; $config [' next_tag_open '] = '
'; $config [' next_tag_close '] = ''; $config [' prev_link '] = ' previous page '; $config [' prev_tag_open '] = '
'; $config [' prev_tag_close '] = ''; $config [' cur_tag_open '] = '
'; $config [' cur_tag_close '] = ''; $config [' num_tag_open '] = '
'; $config [' num_tag_close '] = ''; $this->pagination->initialize ($config); $this->load->view (' Admin/people_daozhen ', $data); }
Model
PHP Code
function People_list2 ($per _nums, $start _position, $askdate, $askdate 2, $name, $age, $age 2, $phone, $sex, $ZXJB, $comefrom , $area) {if ($askdate!=0) {$this->db->where (' askdate >= ', $askdate); } if ($askdate 2!=0) {$this->db->where (' askdate <= ', $askdate 2); } if ($name!=0) {$this->db->like (' username ', $name); } if ($age!=0) {$this->db->where (' Age >= ', $age); } if ($age 2!=0) {$this->db->where (' Age <= ', $age 2); } 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 ($area!=0) {$this->db->where (' area ', $area); } 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, $askdate 2, $name, $age, $age 2, $phone, $sex, $ZXJB, $comefrom, $area) { if ($askdate!=0) {$this->db->where (' askdate >= ', $askdate); } if ($askdate 2!=0){$this->db->where (' askdate <= ', $askdate 2); } if ($name!=0) {$this->db->like (' username ', $name); } if ($age!=0) {$this->db->where (' Age >= ', $age); } if ($age 2!=0) {$this->db->where (' Age <= ', $age 2); } 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 ($area!=0) {$this->db->where (' area ', $area); } $query = $this->db->get ($_session[' user ']->table); return $query->num_rows (); }