How do you do this sub-division?

this is my favorite:

$page = $_GET["page"];
    $page == "" ? $page = 1 : "";

    $page_size = $page_data["data_1"];
    $res = $pdo->query("SELECT * FROM `blog` ");
    $row_count = $res->num_rows;
    $page_num = ceil($row_count / $page_size);
    $offset = ($page - 1) * $page_size;

SQL

LIMIT $offset, $page_size

HTML

<?="<div class="page-layout">"; for($i=1;$i<=$page_num;$iPP){?>
      <button class="pageBtn" <?=$page==$i ? "disabled": "";?> onclick="location.href="?page=<?=$i;?>";"><?=$i;?></button>
    <?} echo "</div>";?>

at present, there are 23 years in total, with a total of 10 years per week
, but I find that the score of https://airbnb.com is quite wonderful:

clipboard.png

so I"d like to ask him how to write this chapter.

Dec.06,2021

this is actually assigned to you by the backend of the last page. As long as you display it, it is really a question of


paging: you need to agree or pass parameters through the API to limit the total number of each page. The backend can query the data of each part through the database, or take it out to do memory paging at a time. Then inform the front end of the total amount of data; The idea of
page number is mainly to control the display according to the current page number and the total page number. For example, when the first page is selected, how to display it. When the current page number is more than 4, the left side appears ellipsis and so on


displays the first page, the last page, the current page and the front and back pages of the current page; more than 5 pages display ellipses

Menu