The CodeIgniter search page is a bit problematic. I have many query conditions, so it may look a little longer. the page can be used, but when I click the next page to jump to the second page, the current page below is not the second page! Please advise. The main problem is that when you click the next page, the next page is displayed, but the current page is incorrect! It is a problem to control the CodeIgniter search page.
I have many query conditions, so it may look a little longer. the page can be used, but when I click the next page to jump to the second page, the current page below is not the second page! Please advise.
The main problem is that when you click the next page, the next page is displayed, but the current page is incorrect! Controller
PHP code
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 ['region']) {$ data ['region'] = $ _ POST ['region'];} $ this-> load-> helper ('URL'); $ this-> load-> database (); $ this-> load-> library ('pagination '); $ config ['per _ page'] = '10'; $ config ['base _ url'] = base_url (). 'index. php/people/lele_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'] =''; $ Config ['full _ tag_close'] ='
'; $ Config ['first _ link'] = 'homepage'; $ config ['first _ tag_open '] ='
'; $ Config ['first _ tag_close'] =''; $ Config ['last _ link'] = 'Last page'; $ 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/lele_daozhen', $ data );}
Model
PHP code
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('username',$name); } if($age!=0){ $this->db->where('age >=',$age); } if($age2!=0){ $this->db->where('age <=',$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($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,$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('username',$name); } if($age!=0){ $this->db->where('age >=',$age); } if($age2!=0){ $this->db->where('age <=',$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($area!=0){ $this->db->where('area',$area); } $query = $this->db->get ($_SESSION['user']->table); return $query->num_rows(); }