<?php
if(mysqli_num_rows($result)>0)
{?>
<table class="table table-striped" id="example" align="center">
<tr>
<thead>
<th style="padding:7px">Name</th>
<th style="padding:7px">Email</th>
<th style="padding:7px">Position</th>
<th style="padding:7px">Action</th>
</thead>
</tr>
<tbody id="myTable">
<?php
echo "<tr>";
while($row=mysqli_fetch_assoc($result))
{
$id = $row['id'];
echo "<td style='padding:7px'>".$row["name"]."</td>";
echo "<td style='padding:7px'>".$row["email"]."</td>";
echo "<td style='padding:7px'>".$row["position"]."</td>";
?>
<td style='padding:7px'><button class="btn btn-info" onclick="deleteUser('<?php echo $row['id'];?>')"> <i class="fa fa-trash"></i> DELETE </button> |
<a class="btn btn-info" href="edit_user.php?id=<?php echo $row['id'];?>"> <i class="fa fa-pencil"></i> EDIT</a> |
<button class="btn btn-info abc" value="View Data" data-id="<?php echo $row['id']; ?>"> <i class="fa fa-eye"></i> VIEW DATA </button>
</td>
<?php echo "</tr>";
} ?>
</tbody>
<tfoot>
<th style="padding:7px">Name</th>
<th style="padding:7px">Email</th>
<th style="padding:7px">Position</th>
<th style="padding:7px">Action</th>
</tfoot>
<?php
echo "</table>";
}
else
{
echo "No row exists";
}
?>
我正在使用 Jquery Datatable 来排序、搜索和分页数据。在我运行代码后,它显示错误 _DT_CellIndex' 未定义。 <tr>
、<td>
、<th>
、<thead>
、<tbody>
、<tfoot>
标签正确使用并正确关闭。
红颜莎娜