Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我的PHP电话簿CRUD项目出错_Php_Mysql_While Loop_Html Table_Syntax Error - Fatal编程技术网

我的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)):
您也没有显示初始开口