Same page I have two tables that need paging, and I have a problem when I instantiate the same paging class.

Source: Internet
Author: User
Paging PHP Data

I have two tables on the same page, all need pagination, I have a paging class, two tables have instantiated this class, but after the page is a problem, there is no data, why this?
This is how I instantiate:
The first table:
$my _page1=new pageclass ($total 1,20,$_get[' page '], '? account= '. $_session[' account ']. ' &act=wyxx&page={page} ');

The second table:
$my _page2=new pageclass ($total 2,20,$_get[' page '], '? account= '. $_session[' account ']. ' &act=blnr&page={page} ');

The paging class is like this:
Class Pageclass{private $myde _count;        Total number of records public $myde _size;        Number of records per page private $myde _page; Current page private $myde _page_count;         Total pages Private $page _url;           Page Urlprivate $page _i;          Start Page private $page _ub; End Page Public $page _limit;function __construct ($myde _count=0, $myde _size=1, $myde _page=1, $page _url)//constructor {$this-   myde_count= $this->numeric ($myde _count);   $this->myde_size= $this->numeric ($myde _size);   $this->myde_page= $this->numeric ($myde _page); $this->page_limit= ($this->myde_page * $this-myde_size)-Myde_size, $this; The beginning of the next page is recorded $this->page_url= $page _url; The address of the connection if ($this->myde_page<1) $this->myde_page=1;     When the current page is less than 1, the value is assigned a value of 1 if ($this->myde_count<0) $this->myde_page=0; $this->myde_page_count=ceil ($this->myde_count/$this->myde_size);//Total pages if ($this->myde_page_count<     1) $this->myde_page_count=1; if ($this->myde_page> $this->myde_page_count) $thiS->myde_page= $this->myde_page_count;   $this->page_i= $this->myde_page-2;          $this->page_i= $this->myde_page-2;         $this->page_ub= $this->myde_page+2;          $this->page_ub= $this->myde_page+2;                if ($this->page_i<1) $this->page_i=1;      if ($this->page_ub> $this->myde_page_count) {$this->page_ub= $this->myde_page_count;}}    Private function numeric ($id)//Determines whether the number {if (strlen ($id)) {if (!ereg ("^[0-9]+$", $id)) $id = 1;   }else{$id = 1; } return $id;} Private Function Page_replace ($page)//address substitution {return Str_replace ("{page}", $page, $this-Page_url);} Private function     Myde_home ()//home {if ($this-myde_page! = 1) {return '
  • Page_replace (1). " \ "Title=\" Home \ "> Home
  • \ n "; }else{return "
  • Home
  • \ n "; }} Private Function Myde_prev ()//prev {if ($this, myde_page! = 1) {return '
  • Page_replace ($this->myde_page-1). " \ "title=\" previous page \ "> previous page
  • \ n "; }else{return "
  • Previous page
  • \ n "; }} Private Function Myde_next ()//Next {if ($this, myde_page! = $this, Myde_page_count) {return]
  • Page_replace ($this->myde_page+1). " \ "Title=\" next \ "> next page
  • \ n "; }else{return "
  • Next page
  • \ n "; }} Private Function Myde_last ()//Last {if ($this, myde_page! = $this, Myde_page_count) {return '
  • Page_replace ($this, Myde_page_count). " \ "Title=\" last \ "> Last
  • \ n "; }else{return "
  • Last
  • \ n "; }} function Myde_write ($id = ' page ')//output {$str = "\ n
      \ n "; $str. = "
    • Total record:". $this-Myde_count."
    • \ n "; $str. = "
    • ". $this, Myde_page." /". $this, Myde_page_count."
    • \ n "; $str. = $this-Myde_home (); $str. = $this-Myde_prev (); For ($page _for_i= $this->page_i; $page _for_i <= $this page_ub; $page _for_i++) {if ($this, myde_page = = $ Page_for_i) {$str. = "
    • ". $page _for_i."
    • \ n "; } else{$str. = "
    • Page_replace ($page _for_i). " \ "Title=\" ". $page _for_i." Page \ ">"; $str. = $page _for_i. "
    • \ n "; }} $str. = $this, Myde_next (); $str. = $this-Myde_last (); $str. = "
    • Myde_page. " \""; $str. = "onmouseover=\" javascript:this.value= "; this.focus (); \" Onkeydown=\ "Javascript:if (event.keycode==13) { Location= ' "; $str. = $this Page_replace ("' +this.value+ ')." "; return false;} \""; $str. = "title=\" Enter the page number you want to reach, then enter! \ "/>
    • \ n "; $str. = "
    "; return $str;}} /*-------------------------instance--------------------------------* $page = new Pageclass (1000,5,$_get[' page '), '? page={ Page} ');//For dynamic $page = new Pageclass (1000,5,$_get[' page '), ' list-{page}.html ');//for Static or pseudo static $page-myde_write ();// Show */


    Reply to discussion (solution)

    Maybe you get the $_get[' page ' should use two,
    $_get[' Page1 '],$_get[' Page2 ']

    Pass the parameters to print out to see, the problem is not big.

    Paging with Ajax

    General pages are rarely seen 2 pages, to achieve the words with Ajax paging bar.

    The parameters that need to be transferred to the page are saved, and when the paging is implemented, the class is instantiated and the saved parameters are called.

    Your two paging parameters are $_get[' page '],php how to identify Ah! PHP in the background to make the appropriate decision to use the paging class

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.