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

Recommended Answers

All 3 Replies

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.

Member Avatar

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

This is my code

Template Name: TaxischulungAnmeldungen-template

<!DOCTYPE html>
    <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" />  

    <image id="mitarbeiterheadingimage" src="http://www.globalxxx.com/wp-content/uploads/2015/12/gtv1.jpg">
    $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'>

    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>";



    <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>


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

Be a part of the DaniWeb community

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