<?php
require_once '../../include/con_data.php';
$shop_id = 1; // muanjai_parksun
$stmt = $pdo->prepare("SELECT id, products_name, price_1, price_2 FROM products WHERE shop_id = :shop_id AND (products_name LIKE '%Lamer Moisturizing Cream%' OR products_name LIKE '%Lamer The Concentrated Night Balm%' OR products_name LIKE '%Lamer The Concentrate Le%')");
$stmt->execute([':shop_id' => $shop_id]);
$res = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html>

<head>
    <title>Check Prices DB</title>
    <style>
        body {
            font-family: sans-serif;
            padding: 20px;
        }

        table {
            border-collapse: collapse;
            width: 100%;
        }

        th,
        td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
        }

        th {
            background-color: #f2f2f2;
        }
    </style>
</head>

<body>
    <h2>ຂໍ້ມູນລາຄາຈາກຖານຂໍ້ມູນ (ຕາຕະລາງ products, shop_id = 1)</h2>
    <table>
        <tr>
            <th>ID</th>
            <th>ຊື່ສິນຄ້າ (products_name)</th>
            <th style="color: blue;">ລາຄາ 1 (price_1)</th>
            <th style="color: red;">ລາຄາ 2 (price_2)</th>
        </tr>
        <?php foreach ($res as $r): ?>
            <tr>
                <td>
                    <?= $r['id'] ?>
                </td>
                <td>
                    <?= htmlspecialchars($r['products_name']) ?>
                </td>
                <td style="color: blue;">
                    <?= number_format($r['price_1'], 2) ?>
                </td>
                <td style="color: red;">
                    <?= number_format($r['price_2'], 2) ?>
                </td>
            </tr>
        <?php endforeach; ?>
    </table>
</body>

</html>