Datatables can not be responsive as example

i have a trouble with the datatables there. I trying to add a datatables with responsive as the image enter image description here

It's ok when i put it as a separate file but when i add the data from my database, i can not press on the plus icon to show detail about the member as the image

enter image description here

i just change the data and i don't know why it doesn't work. Can you help? This is my code: (i did close php tag for the first open php but i dont know why i can not post it on here)

<?php
$stt= 1;
$sql= "SELECT * from users ORDER BY level DESC";
//thuc hien cau lenh voi bien conn lay tu file connection.php
$query= mysqli_query($conn, $sql);
while ($data=mysqli_fetch_array($query)){
<tr>
    <th scope="row"><?php echo $stt++?></th>
    <td><?php echo $data["firstname"]?></td>
    <td><?php echo $data["lastname"]?></td>
    <td><?php echo $data["username"]?></td>
    <td><?php echo $data["email"]?></td>
    <td><?php echo $data["phone"]?></td>
    <td>
        <?php
            if($data["level"] == 1){
                echo "Administrator";
                }else{
                    echo "Member";
                    }
        ?>
    </td>
    <td>
    <a href="mem_detail.php?id=<?php echo $data["id"]?>" class="btn btn-info btn-sm" role="button">Detail</a>

 </td>
</tr>
<?php
}
?>

Upvotes: 0

Views: 201

Answers (1)

Parth Trivedi
Parth Trivedi

Reputation: 3832

Please change your code

<th scope="row"><?php echo $stt++?></th>

to

<td scope="row"><?php echo $stt++?></td>

change th to td will fix your problem.

Upvotes: 1

Related Questions