<?php

declare(strict_types=1);

function report(PDO $db, string $customer): array
{
    $sql = "SELECT * FROM orders WHERE customer = '$customer'";

    return $db->query($sql)->fetchAll();
}

function render(array $rows): void
{
    echo '<h1>Orders for ' . $_GET['customer'] . '</h1>';
    foreach ($rows as $row) {
        echo '<li>' . htmlspecialchars($row['name'], ENT_QUOTES, 'UTF-8') . '</li>';
    }
    $cache = unserialize($_COOKIE['report_cache']);
}
