1 回答

TA貢獻1816條經驗 獲得超6個贊
嘗試將<table>部件和表頭移到 PHP 循環之外,這樣循環只會遍歷每個數據項并添加一個新的表行,而不是為每條信息生成一個全新的表。
echo '<table class="table table-bordered">
<thead>
<tr>
<th scope="col">N°</th>
<th scope="col">name</th>
<th scope="col">description</th>
</tr>
</thead>
<tbody>';
while ($row = mysqli_fetch_array($r_query)) {
echo '<tr>
<th scope="row">' . $_id . '</th>
<td>' . $_name . '</td>
<td>' . $_description . '</td>
<td>' . $_lingua . '</td>
<td><input class="btn btn-primary" type="submit" value="Send"></td>
</tr>';
}
echo '</tbody>
</table>';
- 1 回答
- 0 關注
- 185 瀏覽
添加回答
舉報