<?php
// delete_promo_banner.php

header('Content-Type: application/json');
require 'db_connect.php';

$response = ['status' => 'error', 'message' => 'An unknown error occurred.'];

// The goal is to ensure no promotional banners exist.
// We can simply delete all entries from the table.
$sql = "DELETE FROM promo_banner";

if ($conn->query($sql) === TRUE) {
    // If the query executes without an error, the operation is successful.
    // It doesn't matter if 0 or 1 rows were deleted. The end result is no banner.
    $response['status'] = 'success';
    $response['message'] = 'Promotional banner deleted successfully.';
} else {
    // Only report an error if the database query itself fails.
    $response['message'] = 'Database error: ' . $conn->error;
}

echo json_encode($response);
$conn->close();
?>