【问题标题】:how to add delete button in php?如何在php中添加删除按钮?
【发布时间】:2018-02-14 03:18:31
【问题描述】:
i am very new to coding,

我还在学习散文,有人可以帮助我如何在此表的编码中添加删除按钮, 帮帮我:

这是我的代码:

<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "registration";

// Create connection
$conn = new mysqli('localhost', 'root', '', 'registration');
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

$sql = "SELECT id, name, username, age, email, address FROM users ";
$result = $conn->query($sql);

if ($result->num_rows > 0) {

    echo "<table><tr><th>ID</th><th>Name</th><th>Username</th><th>Age</th><th>Email</th><th>Address</th></tr>";
    // output data of each row
    while($row=mysqli_fetch_array($result)){
        echo "<tr><td>" . $row["id"]. "</td><td>" . $row["name"]. " </td><td>" . $row["username"]. " </td><td>" . $row["age"]. " </td>
        <td>" . $row["email"]. " </td><td>" . $row["address"]. " </td><td>"how i want to add delete button here" </td></tr>";       
  }
 echo "</table>";
} else {
    echo "0 results";
}

$conn->close();
?> 

谢谢

【问题讨论】:

    标签: button sql-delete


    【解决方案1】:

    使用按钮 html 标签。 W3schools 是学习编码的绝佳资源。这是按钮标签上文档的链接:

    https://www.w3schools.com/tags/tag_button.asp

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-30
      • 1970-01-01
      相关资源
      最近更新 更多