PHP: 在数据库中每 15 行创建动态页面

PHP: Create dynamic pages with each 15 rows in Database

我实际上是在开发票务系统。对于管理员,我有一个页面,其中列出了数据库中的前 15 行。 我知道我可以手动为每 15 行创建一个新页面,例如:

SELECT * FROM support ORDER BY `date` DESC LIMIT 15

接下来的 15 行:

SELECT * FROM support ORDER BY `date` DESC LIMIT 15, 15

等等。

但我知道有一个动态的方式.. 谁能解释一下如何做?在其他站点,我得到了这样的位置:

?pageNo=1578

所以我的意思是,如果我的行超过第一页的 15 行,它怎么可能创建个人下一页?希望你明白我的意思。

问候凯文

我的一个旧文件中有这段代码。希望对你有帮助:

<div class='div-table-responsive'>
    <table width='100%' class='tagtable liste listwithfilterbefore sortablesimstats'>
        <thead>
            <th class='left nowrap'><?php print $langs->trans('Customer'); ?></th>
            <th class='center nowrap'><?php print $langs->trans('Date'); ?></th>
            <th class='center nowrap'><?php print $langs->trans('Product'); ?></th>
            <th class='center nowrap'><?php print $langs->trans('Qty2'); ?></th>
            <th class='center nowrap'><?php print $langs->trans('Reason'); ?></th>
            <th class='right nowrap'><?php print $langs->trans('User'); ?></th>
            <th></th>
        </thead>
        <tbody>
            <?php
            $results_per_page = 15;
            $resql = $db->query($object->getWaste()) or die($db->error);
            if (!$resq) {
                dol_print_error($db);
            }
            $number_of_result = mysqli_num_rows($resq);
            $number_of_page = ceil($number_of_result / $results_per_page);
            if (!isset($_GET['page'])) {
                $page = 1;
            } else {
                $page = $_GET['page'];
            }
            $page_first_result = ($page - 1) * $results_per_page;
            $resql2 = $db->query($object->getWaste2($page_first_result, $results_per_page));
            if (!$resql2) {
                dol_print_error($db);
            }
            while ($row2 = $resql2->fetch_assoc()) {
                //output result as table row
            }
            ?>
        </tbody>
    </table>
</div>
<div class="pagination">
    <ul>
        <li class="pagination paginationpage paginationpageleft">
            <?php
            $previous_page = $page - 1;
            if ($previous_page == 0) {
                print '<a href = "fileURL&page=1"><i class="fa fa-chevron-left" title=""></i></a>';
            } else {
                print '<a href = "fileURL&page=' . $previous_page . '"><i class="fa fa-chevron-left" title=""></i></a>';
            }
            ?>
        </li>
        <li class="pagination">
            <?php print $page; ?>
        </li>
        /
        <li class="pagination">
            <?php print $number_of_page; ?>
        </li>
        <li class="pagination paginationpage paginationpageleft">
            <?php $next_page = $page + 1;
            if ($next_page > $number_of_page) {
                print '<a href = "fileURL&page=' . $number_of_page . '"><i class="fa fa-chevron-right" title=""></i></a>';
            } else {
                print '<a href = "fileURL&page=' . $next_page . '"><i class="fa fa-chevron-right" title=""></i></a>';
            }
            ?>
        </li>
    </ul>
</div>