-1
i am very new to coding,

Im still learning the proses, can someone help me on how can i add delete button to my coding at this table, help me:

this is my code:

<?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();
?> 

thank you

1 Answers1

0

Use the button html tag. W3schools is a great resource when learning to code. Here is a link to the documentation on the button tag:

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

Bill
  • 61
  • 2
  • 11