选择下拉列表中的值等于mysql输出

I have a multi dropdownbox thats generate the values from the msyqli output like Amsterdam, Rotterdam, Miami, New York......

I want to select the values whats equal to the values in $cats

So far its okay.

But the problem is the dropdown list have duplicated values. Click here to show the problem How can I fix this problem?

 $resultxx = mysqli_query($database->connection,"SELECT city FROM postcode
 GROUP BY city") or die(mysqli_error());


    $cats = explode(",", $ed['ophaal_locaties']);

    while($land = mysqli_fetch_array($resultxx)){
    $city = $land['city'];

     foreach($cats as $cat) {
    $cat = trim($cat);

     if($cat == $city){
    $sl = 'selected';
    }else{
    $sl = '';
    }

        echo "<option ".$sl.">".$city."</option>";
    }
 }

Try using below SQL query -

SELECT DISTINCT(city) FROM postcode