Jun 8, 2020 09:28 AM
(This post was last modified: Jun 8, 2020 09:36 AM by blackcoder00.)
guys im wonder how can i create some button that delete data from a table i didn't find how could i do it so i have replaced the button with <a> tag ==><a href="edit.php?id= . $$row["name"] for the where condition delete from list where id = '$_GET['name']'
![[Image: T31URyT.png]](https://i.imgur.com/T31URyT.png)
index.php file
updatetable.php file
![[Image: T31URyT.png]](https://i.imgur.com/T31URyT.png)
index.php file
PHP Code
<?php
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "DELETE FROM list where name = '$id'";
if (mysqli_query($conn, $sql)) {
echo "succes delete you can back <a href='index.php' back </a>";
} else {
echo "_error_: " . $sql . "<br>" . mysqli_error($conn);
}
updatetable.php file
PHP Code
<?php
while($row = mysqli_fetch_assoc($result)) {
echo "<tr><td>"."<a href='php/updatetable.php?id=" . $row["name"]. " </a></td><td> " . $row["description"]. "</td><td> " . $row["matiere"]. "</td><td>".$row["date"]."</td><td>".$row["jour"]."</td><td>".$row["time"]."</td></tr></form>";
}
} else {
echo "0 results";
}
echo"</tbody></table></div>";
?>
Writeln('Give me a Target >');
![[Image: giphy.gif]](https://media.giphy.com/media/1n6CecAWjqgaa0fv0K/giphy.gif)


