On the same page, I have two tables that need to be paged. when I instantiate the same paging class, the problem occurs.

Source: Internet
Author: User
On the same page, I have two tables that need to be paged. when I instantiate the same paging class, a problem occurs. I have two tables on the same page, both of which need to be paged. I have a paging class, this class is instantiated in both tables, but there is a problem after pages are turned over. no data is available. why? I instantiate it like this: $ my_page1 = new & nbsp; PageClas for the first table. on the same page, I have two tables that need pagination. when I instantiate the same pagination class, a problem occurs.
I have two tables on the same page, all requiring pagination. I have a paging class, and both tables instantiate this class. However, after turning pages, there is a problem and no data, why?
I instantiate it like this:
In the first table:
$my_page1=new PageClass($total1,20,$_GET['page'],'?account='.$_SESSION['account'].'&act=wyxx&page={page}');

In the second table:
$my_page2=new PageClass($total2,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 number of pages
Private $ page_url; // page url
Private $ 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)-$ this-> myde_size; // start record of the next page
$ This-> page_url = $ page_url; // connection address
If ($ this-> myde_page <1) $ this-> myde_page = 1; // when the current page is smaller than 1, the value is assigned to 1.
If ($ this-> myde_count <0) $ this-> myde_page = 0;
$ This-> myde_page_count = ceil ($ this-> myde_count/$ this-> myde_size); // The total number of 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 it is a number.

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.