Several paging methods for search results in PHP

Source: Internet
Author: User

The pagination of search results in PHP cannot be the same as that of common data. The pagination link is invalid because the form data will not be lost when the pagination link is clicked.

There are several solutions.

The first is to use the website management software to generate static pages for search results and save them for a period of time.

The second is to use session to transmit the search information.

When the search information form is submitted and verified, the session is enabled.

Session_start ();
$ _ Session ["keywords"] = $ X;

$ _ Session ["searchscope"] = $ Y;

... // Assign a value to the search information. Keyword, search range, etc.

On the search results page, enable the session to get the search information and then submit it.

Session_start ();

$ KEYWORDS = $ _ session ["keywords"];

$ Searchscope $ _ session ["searchscope"];

....

The third is to store search information in a database.

After the search information form is submitted, the form content is stored in the database and displayed on the search page. The search page retrieves the search information from the database and starts searching.

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.