prepare($sql); $stmt->bindParam(':driver_id', $driver_id); $stmt->execute(); // Check if any rows were actually deleted $count = $stmt->rowCount(); if ($count > 0) { jsonSuccess(null, "Record deleted successfully"); } else { // Failure occurs if no record exists OR if the record is older than 2 minutes jsonError('No data found to delete (or time limit exceeded)'); } ?>