How to in PHP display more then one result from MySQLi

  mysqli, php

I’m trying this code

        <?php
        $sql = 'SELECT * FROM users ORDER BY id DESC';
        $result = mysqli_query($mysql_db, $sql);
        ?>
        <table class="table">
            <thead class="thead-dark">
                <tr>
                    <th scope="col">ID</th>
                    <th scope="col">Username</th>
                    <th scope="col">MD5 Password</th>
                    <th scope="col">HWID</th>
                    <th scope="col">Time</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <?php while ($row = mysqli_fetch_array($result)) {
                        echo "<td>" . $row[0] . "</td>";
                        echo "<td>" . $row[1] . "</td>";
                        echo "<td>" . $row[2] . "</td>";
                        echo "<td>" . $row[3] . "</td>";
                        echo "<td>" . $row[4] . "</td>nn";
                    }
                    ?>
                 </tr>
            </tbody>
        </table>

But anyway it show results not correctly, i’m not finded anything about this in internet (I could not formulate the correct question)

Source: Ask PHP

LEAVE A COMMENT