What are the implications of using a DATE field in a database table for marking deleted entries in PHP?

Using a DATE field in a database table for marking deleted entries in PHP can be useful for keeping track of when entries were deleted. To implement this, you can set the DATE field to the current date when an entry is marked as deleted, and then filter out entries with a non-null DATE field in your queries to exclude deleted entries.

// Mark entry as deleted by setting the deletion_date field to the current date
$query = "UPDATE table_name SET deletion_date = CURDATE() WHERE id = :id";
$stmt = $pdo->prepare($query);
$stmt->bindParam(':id', $id);
$stmt->execute();

// Retrieve non-deleted entries by excluding entries with a non-null deletion_date field
$query = "SELECT * FROM table_name WHERE deletion_date IS NULL";
$stmt = $pdo->query($query);
$entries = $stmt->fetchAll(PDO::FETCH_ASSOC);