<?php
// printshop/api/get_banners.php

ini_set('display_errors', 1);
error_reporting(E_ALL);

include_once('../../includes/db.php');
header("Content-Type: application/json");

// Fetch banners from a table called `banners`
$banners = fetchAll("SELECT * FROM banners ORDER BY id DESC");

if ($banners) {
    echo json_encode([
        "status" => true,
        "banners" => $banners
    ]);
} else {
    echo json_encode([
        "status" => false,
        "message" => "No banners found."
    ]);
}
