how to link data base delete button to the website delete button

It would have been better for you to post your code, so we can see where the error is coming from. Show some effort.

That said, let's assume that I have a MySQL table named "users" and I want to be able to delete any user I choose. I achieve that by creating a delete-user.php file like the following:

<?php

    $id = $_REQUEST["id"];
    $users = query("DELETE FROM users WHERE id = '$id'");

?>

Then, I have another file named list-users.php where I list all the users, with the following code:

  <?php

      // query users' table to retrieve users' contents
      $users = query("SELECT * FROM users");
      foreach ($users as $row)
      {
      printf("<table>");
      printf("<tr>");
      printf("<td>" . $row["id"] . "</td>");
      printf("<td>" . $row["username"] . "</td>");
      printf("<td>" . $row["firstname"] . "</td>");
      printf("<td>" . $row["lastname"] . "</td>");
      printf("<td>" . $row["usersex"] . "</td>");
      printf("<td><a href='delete-user.php?id=%d'>Delete</a></td>", $row['id']);
      printf("</tr>");
      }
      printf("</table>");
  ?>

Be advised that I used a custom function, "query". So, replace it with your own DB query function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.