I tried this code to get all values from a table "Contact" and then only print each value that's repeated once for example: if groups has the values (A, A, A, B, C) it will only print each one once (A, B, C) and assign each on of the those A, B, C to a new array
$sql = "SELECT Groupss FROM Contact";
$result = $conn->query($sql);
$Grouplist = array();
if (mysqli_num_rows($result) > 0) {
    while ($row = $result->fetch_assoc()) {
        $Grouplist[0] = $row;
        (array_unique($Grouplist[0]));
        foreach ($row as $key => $value) {
            $newarray[] = $value;
            echo  $value;
        }
    }
}
 
     
    