我不明白为什么我的代码不起作用;它只显示 1 个结果,而表中有多个条目。
<?php
$search = $_POST['search'];
print ($search);
$query = "SELECT * FROM student WHERE county= 'sussex'";
$result = mysql_query($query,$conn);
$counter = 0;
$z=0;
while($row = mysql_fetch_assoc($result)){
$id[$counter] = $row['roll_number'];
$counter = $counter + 1;
}
?>
<table border="1" id="table1" >
<th>Id</th>
<th>Type</th>
<th>Description</th>
<th>Operator Id</th>
<?
if($counter>0)
{
for($z=0;$z<$counter;$z++)
{
?>
<tr>
<?
if($z<$counter)
{
?>
<td >
<?php echo $id[$z]?>
</td>
<?
}
$z = $z + 1;
?>
</tr>
</table>