嘿,我一直坚持使用 php 在我的 webapge 上显示表格。每次我尝试新的东西时,我似乎都会遇到新的错误。我真的被困在这里,我正在尝试显示一个表客户端,其中包含列 ID、姓名、电话、电子邮件。我似乎无法将数据放入表中。谁能帮忙使用 mysqli 吗?
<?php
include 'connect.php';
include 'form.php';
echo "<table border=1>";
echo "<tr><th>Id</th><th>Name</th><th>Phone</th><th>Email</th></tr>";
if($result = $mysqli_query("SELECT * from Client")){
while($row = $result->fetch_array(MYSQLI_ASSOC)) {
echo "<tr><td>";
echo $row["ID"];
echo "</td><td>";
echo $row["name"];
echo "</td><td>";
echo $row["email"];
echo "</td><td><a href=delclient.php?id=";
echo $row["id"];
echo ">DEL</a> ";
echo "<a href=addclient.php?id=";
echo $row["id"];
echo ">EDIT</a>";
echo "</td></tr>";
}
echo "</table>";
}
?>
最佳答案
而不是$mysqli_query
,它应该是mysqli_query
:
if($result = mysqli_query("SELECT * FROM Client")) {
关于php - 使用 PHP 显示表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34112543/