I am learning php and I am trying to learn how to show a sql table and be able to delete specific id's in a table.
In the code below, I am echoing a table called Project. My table is only showing Projects created by this user. All this works fine.
I would now like to let the user delete a specific project with a button shown next to each project.
<?php
if( isset($_COOKIE['user_id_cookie']) ){
$my_Query = "SELECT * FROM Project WHERE user_id=".$_COOKIE['user_id'];
$result = mysqli_query($con, $my_Query);
echo "<table id=\"table\"><thead class=\"thead\"><th>Project Name</th><th>Date Modified</th></thead>";
while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
echo "<tbody><tr><td><a href=\"../index.php?ID_Project=".$row['ID_Project']."\">".$row['Name_Project']."</a></td><td class=\"date\">".$row['Date_Project']."</td></tr></tbody>";
}
echo "</table>";
mysqli_close($con);
}
?>
I imagine it looking like this in the end:
||Project Name | Date Modified | ||
|| some name | some date | Delete ||
I would like Something looking like this
How would I best go about this?