i 希望在有2栏和x行数的表格中显示数据库中的数值(类别清单)。
我希望我的网页能够显示:
Apes Cats Apples Cherries Bats Tigers Berries Zebras
不
Apes Apples Bats Bears Cats Cherries Tigers Zebras
我的法典是:
<table border="0" bordercolor="#FFCC00" style="background-color:#FFFFCC" width="400" cellpadding="3" cellspacing="3">
<?php
$query = "SELECT * FROM category ORDER BY cat_name";
$data = mysqli_query($dbc, $query);
while ($category = mysqli_fetch_array($data)) {
?>
<tr>
<td><?php echo $category[ cat_name ] ?></td>
</tr>
<?php } ?>
</table>