List paging display and keyword search

In this section, we will talk about the paging display and keyword search functions.

To do the paging function, we must first connect to the database and obtain data. In most cases we can write paging and search functions in the same php page.

Then let’s analyze the process of the paging function:

First we need to set how many items are displayed on each page and how many pieces of data there are in total, so that we know how many pages there are in total, and This is the page we are currently on.

Let’s compare the code to explain in detail:

 $pageCount)?$pageCount:$pageNow+1; //下一页 ?>

We put paging and keyword search on one page.

In our front-end page, we also need to make some changes:

上一页   下一页

The search function needs to cycle out the data we search based on keywords on the front-end page.

  • The above is the paging and keyword search we introduced. If there is anything you don’t understand, you can leave a message and I will help you answer it in time.

    Continuing Learning
    ||
    $pageCount)?$pageCount:$pageNow+1; //下一页 //我们引用的config.php文件(连接数据库的公共文件,之前提到过)这里没有,所以会在页面右边的显示栏中报错 ?>
    submit Reset Code
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!