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 关注
- 171 浏览
添加回答
举报