Jump to content

Fatal error: Uncaught TypeError: mysqli_num_rows(): Argument #1 ($result) must be of type mysqli_result...on line 28


mikkiharu

Recommended Posts

<!DOCTYPE html>
<html>
<head>
    <title>Registered Users</title>
    <link rel="stylesheet" href="includes/style.css" type="text/css" media="screen"/>
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.min.css">
</head>
<body>
    <?php
    include('includes/header.html');
    ?>
    <center>
        <table id="records">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>First Name</th>
                    <th>Last Name</th>
                    <th>Email</th>
                </tr>>
            </thead>
            <tbody>
                <?php
                    require_once('mysqli_connect.php');
                    $query = "SELECT * FROM users";
                    $result = mysqli_query($dbc,$query);
                    
                    if(mysqli_num_rows($result) > 0) -------------------------------------------------Line 28

                    {
                        while($row = mysqli_fetch_assoc($result))
                        {?>
                            <tr>
                                <td><?php echo $row["id"];?></td>
                                <td><?php echo $row["First Name"];?></td>
                                <td><?php echo $row["Last Name"];?></td>
                                <td><?php echo $row["Email"];?></td>
                            </tr>
                            <?php
                        }
                    }
                    mysqli_close($dbc);
                ?>
            </tbody>
        </table>
    </center>
</body>
<?php include('includes/footer.html');?>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.