Invalid product ID."; return; } $product_id = $_GET['id']; try { $pdo = db(); $stmt = $pdo->prepare("SELECT * FROM products WHERE id = ?"); $stmt->execute([$product_id]); $product = $stmt->fetch(); } catch (PDOException $e) { echo "
Database error: " . htmlspecialchars($e->getMessage()) . "
"; return; } if (!$product) { echo "
Product not found.
"; return; } ?>

Edit Product

' . htmlspecialchars($_SESSION['error_message']) . ''; unset($_SESSION['error_message']); } ?>