Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/237.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/3/html/89.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显示MSQL表并在web浏览器中编辑它_Php_Html_Mysql - Fatal编程技术网

如何使用php显示MSQL表并在web浏览器中编辑它

如何使用php显示MSQL表并在web浏览器中编辑它,php,html,mysql,Php,Html,Mysql,我使用while循环来显示MYSQL表中的所有数据。问题是它没有显示最新的条目。添加记录后,它不会在“我的浏览器”中显示该记录,但会将其添加到数据库中。 它将显示后,我添加另一个。我附上了照片 这是我的代码 <table id="t02" width="100%" border="1px"> <tr> <th>Ec Number</th>

我使用while循环来显示MYSQL表中的所有数据。问题是它没有显示最新的条目。添加记录后,它不会在“我的浏览器”中显示该记录,但会将其添加到数据库中。 它将显示后,我添加另一个。我附上了照片

这是我的代码

  <table id="t02" width="100%" border="1px">
                    <tr>
                        <th>Ec Number</th> 
                        <th>Username</th>
                        <th>Email</th>
                        <th>Phone Number</th>
                        <th>Department</th>
                    </tr>
            <?php 

            $sql = "SELECT * FROM lecturer";

            $result = $conn->query($sql);

            $row = $result->fetch_assoc();

            while ($row = $result->fetch_assoc()){
                echo "<tr>";

                echo "<td>".$row['ecnumber']."</td>";
                echo "<td>".$row['username']."</td>";
                echo "<td>".$row['email']."</td>";
                echo "<td>".$row['phonenumb']."</td>";
                echo "<td>".$row['dept']."</td>";

                echo "</tr>";
            }

            ?>


                </table>

Ec编号
用户名
电子邮件
电话号码
部门
每次都会把你推进第二排。删除第一个
fetch
调用。每次
fetch
都会前进一行。例如:

$row = $result->fetch_assoc();
$row = $result->fetch_assoc();
$row = $result->fetch_assoc();
print_r($row);
将打印第三行

每次都会把你推进第二排。删除第一个
fetch
调用。每次
fetch
都会前进一行。例如:

$row = $result->fetch_assoc();
$row = $result->fetch_assoc();
$row = $result->fetch_assoc();
print_r($row);

将打印第三行。

如何确保我是堆栈溢出上的新成员投票标记旁边应该有一个复选标记,这是一个显示我刚才做的详细信息的链接,显示我是否直接删除或编辑该记录而不访问phpmyadmin数据库?我如何做到我是堆栈溢出的新手投票标记旁边应该有一个复选标记,这里有一个链接,显示了我刚才做的详细信息,显示了我是否可以直接删除或编辑该记录,而不必访问phpmyadmin数据库?