如何隐藏大分页的中间页码?

时间:2018-09-26 08:52:18

标签: pagination

因为我的数据库很大,所以我的分页超过300页。现在我只想显示例如// 1 2 3 .... 380 381 //带有“下一个”和“上一个”按钮。请帮助我。

$

    <div class="esil">
        <div class="customers">
            <table class="table">
                    <tr>
                        <th>CursistID</th>
                        <th>BedrijfID</th>
                        <th>Achternaam</th>
                        <th>Voorletters </th>
                        <th>Geboortedatum</th>
                        <th>Adres</th>
                        <th>Postcode</th>
                        <th>Woonplaats</th>
                        <th>Geslacht</th>
                        <th>Voornaam</th>
                        <th>Land</th>
                        <th>Mobiel</th>
                        <th>Email</th>
                        <th>Geboorteplaats</th>
                        <th>Telefoonnummer</th>
                        <th>Burgerservicenummer</th>
                        <th>Opmerking</th>    
                        <th>VCAnummer</th>
                    </tr>
        </div>
        <div>
            <?php

                // Verbind met de Database
                $conn = mysqli_connect("127.0.0.1", "root", "", "planningssysteem");

                $page = $_GET["page"];
                    if($page=="" || $page=="1"){
                        $page1 = 0;
                    }
                    else{
                        $page1 = ($page*50)-50;
                    }

                $res=mysqli_query($conn, "SELECT * from cursisten limit $page1 ,50");

                while($row=mysqli_fetch_array($res)){
                    echo "<tr><td>".
                            $row["CursistID"] ."</td><td>".
                            $row["BedrijfID"] ."</td><td>".
                            $row["Achternaam"] ."</td><td>".
                            $row["Voorletters"] ."</td><td>".
                            $row["Geboortedatum"] ."</td><td>".
                            $row["Adres"] ."</td><td>".
                            $row["Postcode"] ."</td><td>".
                            $row["Woonplaats"] ."</td><td>".
                            $row["Geslacht"] ."</td><td>".
                            $row["Voornaam"] ."</td><td>".
                            $row["Land"] ."</td><td>".
                            $row["Mobiel"] ."</td><td>".
                            $row["Email"] ."</td><td>".
                            $row["Geboorteplaats"] ."</td><td>".
                            $row["Telefoonnummer"] ."</td><td>".
                            $row["Burgerservicenummer"] ."</td><td>".
                            $row["Opmerking"] ."</td><td>".
                            $row["VCAnummer"] ."</td></tr>";
                    echo "<br>";
                }

                $res1 = mysqli_query($conn, "SELECT * from cursisten");
                $cou = mysqli_num_rows($res1);

                echo "</table>";

                ?>

                </div>

    </div>

    <div>
        <?php

                $a = $cou/50;
                $a = ceil($a);
                echo "<br>"; echo "<br>";
                    for($b=1;$b<=$a;$b++){
                        ?><a href="testindex.php?page=<?php echo $b; ?>" style="text-decoration:none "><?php echo $b." "; ?></a> <?php
                    }




            ?>
    </div>      

</body>

$

0 个答案:

没有答案