0

I m in the process of creating a sql table which acts as a stafflist that has several columns like name , number , email and delete.
One webpage on the website gives out the rows of this table and i would like to have a clickable link in the delete column or better said in the delete part of each row that will delete that row from the table. For example a staffmember leaves the company . On the page listing the sql table with last column delete you just press delete in that ex staffmember and that row will be remove from the stafflist table showing up. Some leads i have through research is

<a href="admin.php?action=delete&id=$id">Delete this!</a>

but it doesnt work.Maybe someone has a whole different approach , whatever works Thx

3
Contributors
3
Replies
11
Views
1 Year
Discussion Span
Last Post by Latrell_vie
0

but it doesnt work

What doesn't work? Do you have an admin page that executes a delete query? Do you have code? Do you get an error? Be specific.

0

To start, we'll need to see the function that's executed when action=delete.

0

This is my code

<?php
/*
Template Name: TaxischulungAnmeldungen-template
*/
?>

<!DOCTYPE html>
<html>
<head>
    <title>Taxischule Anmeldungen</title>
    <meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('template_url'); ?>/mitarbeiter.css" />  


</head>
<body>
    <image id="mitarbeiterheadingimage" src="http://www.globalxxx.com/wp-content/uploads/2015/12/gtv1.jpg">
<?php
    $servername = "globalxxx.com.mysql";
    $username = "globalxxx_com";
    $password = "wienxxx";
    $dbname = "globalxxx_com";



    $con=mysqli_connect($servername, $username, $password,$dbname);
        if (mysqli_connect_errno())
      {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
      }

    $result = mysqli_query($con,"SELECT * FROM mitarbeiterinfo");



    echo "<table border='1'>
    <tr>
    <th>Vorname</th>
    <th>Nachname</th>
    <th>Email</th>
    <th>Telefonnummer</th>
    <th>Termin</th>
    <th>entfernen</th>
    </tr>";

    while($row = mysqli_fetch_array($result))
      {
      echo "<tr>";
      echo "<td>" . $row['vorname'] . "</td>";
      echo "<td>" . $row['nachname'] . "</td>";
      echo "<td>" . $row['email'] . "</td>";
      echo "<td>" . $row['telefonnummer'] . "</td>";
      echo "<td>" . $row['termin'] . "</td>";
      echo "<td>" . "<a href='delete.php?id=".$row['id']."'>Delete</a>" . "</td>";
      echo "</tr>";
      }
    echo "</table>";

    mysqli_close($con);

?>

    <div id="zuruecklink"><a href="http://www.globalxxx.com/wp-login.php?action=logout&redirect_to=index.php&_wpnonce=39cdcd6ca5">Zur&uumlck zum Menu</a></div>


</body>
</html>

Problem i now have is that i get directed to a subpage, with same URL and /delete.php?id= appended , which will show 404 error , so i cant check if the code works

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.