A jump is successful, but the page paging function fails.

Source: Internet
Author: User
A jump is successful, but the page paging function fails. please kindly advise require_once 'Conn. php ';
$ SQL = "select * from help_relation ";
$ Result = mysql_query ($ SQL );
$ Num = mysql_num_rows ($ result );
$ Pagesize = 2; // set the number of records per page
$ Pages = ceil ($ num/$ pagesize); // get the total number of pages
If ($ pages <1) {$ pages = 1;} // you can specify at least one page for the total number of pages.
$ Page = $ _ GET [page]; // GET the number of pages passed
If ($ page> $ pages) {$ page = $ pages;} // if the transferred page number is larger than the total page number, make it equal to the total page number.
If ($ page <1) {$ page = 1;} // if the passed page number is less than 1, set it to 1.
$ Kaishi = ($ page-1) * $ pagesize; // initial limit record for the next step
If (isset ($ _ GET ['Help _ keyword_id '])! = ''){
$ Help_keyword_id = $ _ GET ['Help _ keyword_id '];
$ SQL = "select * from help_relation where help_keyword_id = '$ help_keyword_id 'Order by help_keyword_id desc limit $ kaishi, $ pagesize"; // retrieve records starting from the calculated initial value, total $ pagesize entries
$ Result = mysql_query ($ SQL); // obtain the result
While ($ row = mysql_fetch_array ($ result ))
{
Echo"\ N ";
// Echo"". $ Row ['id']."\ N ";
Echo"". $ Row ['Help _ topic_id ']."";
Echo"\ N ";
}
}
This is the code


Reply to discussion (solution)

No code passed for page and help_keyword_id
$ Help_keyword_id only exists when there is an passed-in help_keyword_id. will no error be reported when no request is passed in?

So how should we change it? Should we re-write an SQL statement?

Sorry, I am eager to use it. I cannot find it on the Internet.

Are you online? You only do the paging and do not display the page number ~ Of course I can't do it?
Do you want to display the page number?

On the first page, is your current website? Page = 1
You don't have $ page. Is there a problem? You must at least display the first page when judging that the page is empty.

The other $ help_keyword_id is the same. you can GET it through $ _ GET. your link must exist.

Example: www.baidu.com? Page = 1 & help_keyword_id = 15
In this way, you can get it.

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.