<?php
date_default_timezone_set('Asia/Colombo');
include '../config.php';
header('Content-Type: application/json');

$result = $conn->query('SELECT id, name, price, stock FROM products WHERE stock > 0 ORDER BY name');
$products = [];
while ($row = $result->fetch_assoc()) {
    $products[] = $row;
}
echo json_encode($products);
