1
我試圖抓住我的MYSQL表格中的所有內容,然後將其全部放入表格中。出於某種原因,它將它全部放入一行中,而不是爲更多數據創建新行。我的表格沒有正確填充
我有我的代碼在這裏:
<?php
//DISPLAY CURRENT USERS ASC ON VIEW
$q="SELECT * FROM users ORDER BY id ASC";
$r=mysqli_query($dbc,$q);
?>
<div class="panel panel-default">
<!-- Default panel contents -->
<div class="panel-heading">User Manager</div>
<div class="panel-body">
<p>Some default panel content here. Nulla vitae elit libero, a pharetra augue. Aenean lacinia bibendum nulla sed consectetur. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
</div>
<!-- Table -->
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>UserID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Status</th>
<th>Role</th>
</tr>
</thead>
<tbody>
<?php echo "<tr>"; // Display Users onto table
while (($list= mysqli_fetch_assoc($r))){
echo"<td>".$list['id']."</td>";
echo"<td>".$list['fname']."</td>";
echo"<td>".$list['lname']."</td>";
echo"<td>".$list['email']."</td>";
echo"<td>".$list['status']."</td>";
echo"<td>".$list['role']."</td>";
}
echo"</tr>";?>
</tbody>
</table>
</div>
</div>
並在環路外取出'
謝謝大家修復它。對不起,延遲已經遠離編碼了一下。感謝你的幫助! – Ready
回答
所有
TR
標籤是退出循環。來源
2014-04-06 17:02:24 Benio
doh!愚蠢的錯誤。感謝Benio,你真棒! – Ready
看來你需要啓動
和 結束與
現在你正在做這個while循環中只有一次
來源
2014-04-06 17:03:14
相關問題