<?php
$product = 'sweater';
$query = "select distinct color from products where product = ?;";
// get DB version using PDO
$stmt = $pdo->prepare($query);
$stmt->execute([$product]);
$colors = $stmt->fetchAll(PDO::FETCH_ASSOC);
print_r($colors);
SELECT DISTINCT color FROM TableName;
SELECT color FROM TableName GROUP BY color;