I have written some code to echo my table:
<?php while($product = mysqli_fetch_assoc($result)) : ?>
<tr>
<td><?php echo $product['id']; ?></td>
<td><?php echo $product['customer_id']; ?></td>
<td><?php echo $product['total_price']; ?></td>
<td><?php echo $product['created']; ?></td>
<td><?php echo $product['modified']; ?></td>
<td><a href="delete.php"><span class="glyphicon glyphicon-remove"></span></a></td>
</tr>
<?php endwhile?>
Last td element is created for specific table row removal. However I don't know how to get that row id. This is my delete.php file:
<?php
require_once 'core/init.php';
$id = $_GET['id'];
mysqli_query($db,"DELETE FROM orders WHERE id='".$id."'");
mysqli_close($db);
header("Location: details-modal-orders.php");
?>
I assume i should change something in this line:
<td><a href="delete.php"><span class="glyphicon glyphicon-remove"></span></a></td>
After delete.php there should be somekind of id recognizer or something. Please help. I also don't know how to create that because it is inside of a while loop. I'm afraid something is not going to work well.