, Plagued me for a long time paging problems

Source: Internet
Author: User
For help, the paging problem that has plagued me for a long time is that the pagination value is displayed normally and the paging display is normal, but once assigned a value (I want someone to enter a date, can automatically go to the information that month), it will not work, the first page is normal, the second page will not be displayed normally, I think the value is probably not passed to the next page, but I won't change it ~ Please help. The manager is impatient ~ I'm crazy. entering the date page, scym. php & lt; h for help, has plagued my paging problems for a long time.
My paginated values are displayed normally, but pages are displayed normally, but once assigned values (I want others to enter the date, they can automatically find the information for that month), it will not work, the first page is normal, and the second page cannot be displayed normally. I think the value is not uploaded to the next page, but I will not change it ~ Please help
The manager is impatient ~ I'm going crazy,

Enter the date page, scym. php


Date













Display Page, szym. php





Data



Include ("conn. php ")
?>

$ Rql = $ _ POST [rq];
$ Page_size = 15;

$ Results = mysql_query ("select date (visit_time) as dv, answer_type as atl, count (1) as co from om_log_ask_detail _ $ rql group by date (visit_time), answer_type ");
$ Count = mysql_num_rows ($ results );
$ Page_count = ceil ($ count/$ Page_size );

$ Init = 1;
$ Page_len = 5;
$ Max_p = $ page_count;
$ Pages = $ page_count;
If (empty ($ _ GET ['Page']) | $ _ GET ['Page'] <0 ){
$ Page = 1;
} Else {
$ Page = $ _ GET ['Page'];
}

$ Offset = $ Page_size * ($ page-1 );
$ SQL = "select date (visit_time) as dv, answer_type as atl, count (1) as co from om_log_ask_detail _ $ rql group by date (visit_time), answer_type limit $ offset, $ Page_size ";

$ Result = mysql_query ($ SQL );

Echo "". "data ($ rql )"."";

Echo"















";While ($ row = mysql_fetch_array ($ result )){Echo" ";Echo" ";Echo" ";Echo" ";Echo" ";}Echo"
Date Answer type Quantity
". $ Row ['dv']."". $ Row ['atl ']."". $ Row ['Co']."
";

Mysql_close ($ con );

?>


$ Page_len = ($ page_len % 2 )? $ Page_len: $ pagelen + 1; // Number of page numbers
$ Pageoffset = ($ page_len-1)/2; // page number offset between left and right

$ Key = '';
$ Key. = "$ page/$ pages"; // page
If ($ page! = 1 ){
$ Key. = "first page"; // first page
$ Key. = "previous page"; // Previous Page
} Else {
$ Key. = "first page"; // first page
$ Key. = "previous page"; // Previous Page
}
If ($ pages> $ page_len ){
// If the current page is less than or equal to the left offset
If ($ page <= $ pageoffset ){
$ Init = 1;
$ Max_p = $ page_len;
} Else {// if the current page is greater than the left offset
// If the right offset of the current page number exceeds the maximum page number
If ($ page + $ pageoffset >=$ pages + 1 ){
$ Init = $ pages-$ page_len + 1;
} Else {
// Calculation when both the left and right offsets exist
$ Init = $ page-$ pageoffset;
$ Max_p = $ page + $ pageoffset;
}
}
}
For ($ I = $ init; $ I <= $ max_p; $ I ++ ){
If ($ I = $ page ){
$ Key. = ''. $ I .'';
} Else {
$ Key. = "". $ I ."";
}
}
If ($ page! = $ Pages ){
$ Key. = "next page"; // Next page
$ Key. = "Last page"; // Last Page

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.