diff --git a/cart.php b/cart.php index 34cb2f296beff01d147cffcd6b9c4e9660788cab..12151b4ce504066d1bc4ffa84bdfc22da7e8cd46 100644 --- a/cart.php +++ b/cart.php @@ -8,7 +8,7 @@ if (!isset($_SESSION['user_id'])) { die("กรุณาเข้าสู่ระบบก่อน"); } -// ✅ เพิ่มสินค้าเข้า `cart` +//เพิ่มสินค้าเข้า cart if (isset($_GET['add'])) { $stmt = $conn->prepare(" INSERT INTO cart (id, users_id, products_id, qty) @@ -20,7 +20,7 @@ if (isset($_GET['add'])) { exit; } -// ✅ อัปเดตจำนวนสินค้า +//อัปเดตจำนวนสินค้า if (isset($_GET['update']) && isset($_GET['qty'])) { $qty = max(1, intval($_GET['qty'])); // ป้องกันค่าติดลบ $stmt = $conn->prepare("UPDATE cart SET qty = ? WHERE users_id = ? AND products_id = ?"); @@ -29,7 +29,7 @@ if (isset($_GET['update']) && isset($_GET['qty'])) { exit; } -// ✅ ลบสินค้าออกจาก `cart` +//ลบสินค้าออกจาก cart if (isset($_GET['remove'])) { $stmt = $conn->prepare("DELETE FROM cart WHERE users_id = ? AND products_id = ?"); $stmt->execute([$_SESSION['user_id'], $_GET['remove']]); @@ -37,7 +37,7 @@ if (isset($_GET['remove'])) { exit; } -// ✅ ดึงข้อมูลจาก `cart` และ `products` +//ดึงข้อมูลจาก cart และ products $stmt = $conn->prepare(" SELECT cart.*, products.name, products.price FROM cart