<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);

include_once __DIR__ . "/config.php";

echo json_encode([
    'users' => $connection->query("SELECT userid, name, isAdmin, is_agent FROM `users` LIMIT 15")->fetch_all(MYSQLI_ASSOC),
    'orders_count' => $connection->query("SELECT COUNT(*) as count FROM `orders_list`")->fetch_assoc(),
    'orders_status' => $connection->query("SELECT status, COUNT(*) as count FROM `orders_list` GROUP BY status")->fetch_all(MYSQLI_ASSOC),
    'admin_orders' => $connection->query("SELECT * FROM `orders_list` WHERE `status` = 1 LIMIT 5")->fetch_all(MYSQLI_ASSOC)
]);
