<?php
session_start(); 
$u_uname = '';
if (isset($_COOKIE['auth_token'])) {
    $u_uname = $_COOKIE['auth_token'];
} else {
    header("location:login.php");
    exit; 
}
?>

<?php include 'include/header.php'; ?>
<?php include 'include/aside.php'; ?>
<?php include 'include/connection.php'; ?>

<!--start page wrapper -->
<div class="page-wrapper">
    <div class="page-content">
        <h6 class="mb-0 text-uppercase">All users</h6>
        <hr/>

        <div class="card">
            <div class="card-body">
                <div class="table-responsive">
                    <table id="example2" class="table table-striped table-bordered">
                        <thead>
                            <tr>
                                <th>SR. No</th>
                                <th>User ID</th>
                                <th>Full name</th>
                                <th>Email ID</th>
                                <th>Mobile No</th>
                                <th>Gender</th>
                                <th>Company Name</th>
                                <th>Company Address</th>
                                <th>Blocking status</th>
                                <th>wallet balance</th>
                                <th>password</th>
                                 <th>Date</th>
                              
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $sql = "SELECT * FROM users";
                            $result = $link->query($sql);
                            $sr = 1; // Initialize serial number
                            
                            if ($result->num_rows > 0) {
                                // Output data of each row
                                while($row = $result->fetch_assoc()) {
                                    ?>
                                    
                                    <tr>
                                    <td><?php echo  $row['id'] ?></td>
                                    <td><?php echo$row['user_id'] ?></td>
                                    <td><?php $row['full_name'] ?></td>
                                    
                                    <td><?php echo $row['email_id'] ?></td>
                                    <td><?php echo $row['mobile_no'] ?></td>
                                    <td><?php echo  $row['gender'] ?></td>
                                    <td><?php echo$row['company_name'] ?></td>
                                    <td><?php echo $row['company_address'] ?></td>
                                    <td><?php echo $row['blocking_status'] ?></td>
                                    <td><?php echo $row['wallet_balance'] ?></td>
                                    <td><?php echo $row['password'] ?></td>
                                     <td><?php echo $row['date_of_joining'] ?></td>
                                  
                                    </tr>
                                    <?php
                                    $sr++; 
                                }
                            } else {
                                echo "<tr><td colspan='8'>No data available</td></tr>";
                            }
                            ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<!--end page wrapper -->

<?php include 'include/footer.php'; ?>
