<?php
// get_promo_banner.php

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

$sql = "SELECT image_url FROM promo_banner ORDER BY id DESC LIMIT 1";
$result = $conn->query($sql);

if ($result && $result->num_rows > 0) {
    $banner = $result->fetch_assoc();
    echo json_encode($banner);
} else {
    // If no banner is found, return an empty image_url
    echo json_encode(['image_url' => '']);
}

$conn->close();
?>