prepare($sql);
$stmt->execute($params);
$products = $stmt->fetchAll(PDO::FETCH_ASSOC);
} catch (Exception $e) { $products = []; }
// --- 3. FETCH CATEGORIES FOR SIDEBAR ---
try {
// Agar alag table hai 'categories' to wahan se layein, warna products table se distinct nikal lein
$catStmt = $pdo->query("SELECT DISTINCT category FROM products WHERE category != ''");
$categories = $catStmt->fetchAll(PDO::FETCH_COLUMN);
} catch (Exception $e) { $categories = []; }
?>
Browse Premium Scripts & CodesOur Shop