<?php endwhile; ?>
行出现错误。
错误:
分析错误:语法错误,意外的"endwhile"(T_endwhile);
代码:
$result = mysqli_query($connect,"SELECT* FROM contacts");
?>
<table width="800" cellpadding="10" cellspacing="5" border="2">
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Contact No</th>
<th>Email</th>
</tr>
<?php while ($row = mysqli_fetch_array($result)); ?>
<tr>
<td><?php echo $row['first_name']; ?></td>
<td><?php echo $row['last_name']; ?></td>
<td><?php echo $row['contact_no']; ?></td>
<td><?php echo $row['email']; ?></td>
</tr>
<?php endwhile; ?>
</table>
表中未显示任何记录。页面只是显示错误。
如果要使用endwhile;
,则应在while
的条件后面加冒号(:
),而不是分号(;
):
<?php while ($row = mysqli_fetch_array($result)): ?>
<!-- Here --------------------------------------^ >