<?php
include('../connection.php');
mysqli_set_charset($conn, 'utf8mb4');
header("Content-Type: application/json");

$sql = "SELECT * FROM marketing ORDER BY id DESC";
$result = $conn->query($sql);

if ($result && $result->num_rows > 0) {
    $data = [];
    while ($row = $result->fetch_assoc()) {
        $data[] = $row;
    }
    echo json_encode($data);
} else {
    echo json_encode([]);
}

$conn->close();
?>
