Simple pagination in PHP

This is a simple PHP pagination script. First create a database and create a table name users  then connect your database by hostname, username, password, dbname to run this script. you can change table name and add more column.

<?php

$conn = new mysqli('hostname', 'user', 'password', 'dbname');
$start = 0;
$limit = 10;

if (isset($_GET['id'])) {
    $id = $_GET['id'];
    $start = ($id - 1) * $limit;
} else {
    $id = 1;
}
$sql = "SELECT * FROM users LIMIT $start, $limit";
$query = $conn->query($sql);
?>

<html>
<head></head>
<body>
    <table>
        <tr>
            <th>Name</th>
            <th>department</th>
        </tr>
        <?php
        while ($result = mysqli_fetch_array($query)) { ?>
        <tr>
            <td><?= $result['name'] ?></td>
            <td><?= $result['department'] ?></td>
        </tr>
        <?php } ?>

    </table>
    <?php
    $rows = mysqli_num_rows(mysqli_query($dbconfig, "select * from user"));
    $total = ceil($rows / $limit);
    if ($id > 1) {
        echo "<a href='?id=" . ($id - 1) . "' class='button'>PREVIOUS</a>". "      ";
    }
    if ($id != $total) {
        echo "<a href='?id=" . ($id + 1) . "' class='button'>NEXT</a>";
    }
    ?>
    <ul class='page'>
        <?php
        for ($i = 1; $i <= $total; $i++) {
            if ($i == $id) {
                echo "<li class='current'>" . $i . "</li>";
            } else {
                echo "<li><a href='?id=" . $i . "'>" . $i . "</a></li>";
            }
        }
        ?>
    </ul>
</body>
</html>