我正在创建用户管理系统仪表板,我想在其中显示我的用户列表,如电子商务网站产品列表
我的PHP代码是。
sameorigin
我希望我的用户输出看起来应该是动态的。
<?php
$connect = mysqli_connect("localhost", "root", "xxxxx", "xxxxx");
$query = "SELECT * FROM users";
$result = mysqli_query($connect, $query);
?>
<div style="width:700px;">
<div class="table-responsive">
<table class="table table-bordered">
<tr>
<th width="20%">Location</th>
<th width="20%">Employee Name</th>
<th width="30%">Last Login</th>
<th width="30%">View</th>
</tr>
<?php
while($row = mysqli_fetch_array($result))
{
?>
<tr>
<td><?php echo $row["Location"]; ?></td>
<td><?php echo $row["userName"]; ?></td>
<td><?php echo $row["session"]; ?></td>
<td><input type="button" name="view" value="view" id="<?php echo $row["userEmail"]; ?>" class="btn btn-info btn-xs view_data" /></td>
</tr>
<?php
}
?>
</table>
</div>
</div>
请帮忙。
答案 0 :(得分:0)
请勿使用表格来构建您的网站/网络应用程序。您可以使用Bootstrap轻松实现响应式设计。你应该使用Bootstrap的grid system。
您可以使用以下内容:
<div class='container'>
<div class=row>
<div width="20%">Location</div>
<div width="20%">Employee Name</div>
<div width="30%">Last Login</div>
<div width="30%">View</div>
</div>
<?php
while($row = mysqli_fetch_array($result))
{
echo "<div class='col-md-4'>".$yourDataHere."</div>
}
?>
</div>