1 回答
TA貢獻(xiàn)2016條經(jīng)驗(yàn) 獲得超9個(gè)贊
您需要將字段行放在循環(huán)的一側(cè)
<?php
// DB Query
$result=mysqli_query($dbcon,$consult); $i=0;
// Starting the table
print ("
<table>
<tr>
<th>NIF</th>
<th>Name</th>
<th>lastname</th>
<th>Edad</th>
</tr>");
// Result loop
while($row=mysqli_fetch_row($result)){
// Table content
print ("
<tr>
<td>".$row[0]."</td>
<td>".$row[1]."</td>
<td>".$row[2]."</td>
<td>".$row[3]."</td>
</tr>");
$i++;
}
// No results
if ($i==0){
print ("
<tr>
<td colspan='4'>No results</td>
</tr>");
}
// Closing table
print ("</table>");
?>
- 1 回答
- 0 關(guān)注
- 104 瀏覽
添加回答
舉報(bào)
