> 백엔드 개발 > PHP 튜토리얼 > CodeIgniter 搜索分页有点有关问题,帮忙看下

CodeIgniter 搜索分页有点有关问题,帮忙看下

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
풀어 주다: 2016-06-13 13:53:11
원래의
1077명이 탐색했습니다.

CodeIgniter 搜索分页有点问题,帮忙看下
我的查询条件比较多,所以可能稍微显得长了点,分页是可以用,但是点击下一页,跳转到第二页的时候,下面的当前页并不是第二页!请指教。

主要问题就是,点击下一页的时候,已经跳转到下一页,但是当前页显示不正确!控制器

PHP code

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

<!--

 

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'] = '

로그인 후 복사
  • '; $config ['first_tag_close'] = '
  • '; $config ['last_link'] = '尾页'; $config ['last_tag_open'] = '
  • '; $config ['last_tag_close'] = '
  • '; $config ['next_link'] = '下一页'; $config ['next_tag_open'] = '
  • '; $config ['next_tag_close'] = '
  • '; $config ['prev_link'] = '上一页'; $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 ); }
    模型

     
    PHP code

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    21

    22

    23

    24

    25

    26

    27

    28

    29

    30

    31

    32

    33

    34

    35

    36

    37

    38

    39

    40

    41

    42

    43

    44

    45

    46

    47

    48

    49

    50

    51

    52

    53

    54

    55

    56

    57

    58

    59

    60

    61

    62

    63

    64

    65

    66

    67

    68

    69

    70

    71

    72

    73

    74

    75

    76

    77

    <!--

     

    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 db->like('username',$name);

                    }

                    if($age!=0){

                            $this->db->where('age >=',$age);

                    }

                    if($age2!=0){

                            $this->db->where('age 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 db->like('username',$name);

                    }

                    if($age!=0){

                            $this->db->where('age >=',$age);

                    }

                    if($age2!=0){

                            $this->db->where('age 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();

            }

     <div class="clear">

                      

                   

                   

             

                </div>

    로그인 후 복사
    관련 라벨:
    본 웹사이트의 성명
    본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
    인기 튜토리얼
    더>
    최신 다운로드
    더>
    웹 효과
    웹사이트 소스 코드
    웹사이트 자료
    프론트엔드 템플릿