I need some advice on how to dynamically target the rows I wish to delete as currently I am manually having to alter my php script to delete rows but am a little stuck on where to go next.
so here is my index of items:
<?php
$result = mysqli_query($con,"SELECT * FROM items");
while($row = mysqli_fetch_array($result)) {
echo $row['added'] . $row['content'] . $row['id'];
echo "<br>";
echo "Mark as complete";
echo "<br>";
echo "<a href='delete.php'>Delete Item</a>";
echo "<br>";
echo "<a href='update.php'>Edit Item</a>";
echo "<br>";
echo "<br>";
}
mysqli_close($con);
?>
If I click on delete item it will only delete the one I have specified it to in my php here:
mysqli_query($con,"DELETE FROM items WHERE id='14'");
mysqli_close($con);
Now I need to know how to tell the button to delete the item that the link is associated to as you can I have manually entered 14 so that will delete that one. But I need some instruction or advice on how to delete the row or item id of that row in the database.
My initial thoughts are I am going to need to pass some information about this row perhaps using $_GET?