我的PHP电话簿CRUD项目出错
我在我的PHP电话簿CRUD项目出错,php,mysql,while-loop,html-table,syntax-error,Php,Mysql,While Loop,Html Table,Syntax Error,我在行中遇到一个错误 错误: $result = mysqli_query($connect,"SELECT* FROM contacts"); ?> <table width="800" cellpadding="10" cellspacing="5" border="2"> <tr> <th>First Name</th> <th>Last Na
行中遇到一个错误
错误:
$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'(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>
$result=mysqli_query($connect,“SELECT*FROM contacts”);
?>
名字
姓
联系电话
电子邮件
表中未显示任何记录。页面只是显示错误。如果要使用
endwhile
,则应使用冒号(:
)而不是分号(;
)跟随while的条件:
如果要使用endwhile
,则应使用冒号(:
)而不是分号(;
)跟随while的条件:
在while($row=mysqli\u fetch\u array($result))语句中查看分号
,它应该是while($row=mysqli_fetch_数组($result)):
您也没有显示初始开头请参见此语句中的分号while($row=mysqli_fetch_数组($result))代码>,它应该是而($row=mysqli\u fetch\u array($result)):
您也没有显示初始开口