to delete 14 row by 1 click

You should have a hyperlink for delete action.

<a href="https://stackoverflow.com/questions/50769173/delete.php?id=<?php echo $row->id;?>">
Delete Record
</a>

Here it appends record ID in url and it looks like delete.php?id=15

Now you want to delete previous 14 records.

$currentId = $_GET['id'];//got from URL
$nextLimit = $currentId - 14; //in case of next 14 you need to add

Your SQL Query should be:

$query = "delete from table
          where id between '$currentId' and '$nextLimit'";

and execute the query.

Leave a Comment