My query returns from my database rows of data containing arrays of years. For example:
1 > 2004,2005,2006,2007 
2 > 2003,2004,2005 
3 > 2004,2005,2006,2007.
When I select this data I combine it into an array then use array_unique to filter out the duplicates, however this does not work. I am returned with a complete array containing all values.
mysql_query('select * from stock where Make LIKE "%'.$_REQUEST['Make'].'%" AND Model LIKE "%'.$_REQUEST['model'].'%" group by YearRange order by YearRange DESC');
while($row=mysql_fetch_array($Year)){
    $a = explode(',', $row['YearRange']);
    $unique_array = array_unique($a);
    foreach ($unique_array as $key => $value)
    {
        echo "<option>".$value."</option>";
    }
}
So in the above example where I would only want the following values to show:
2003,2004,2005,2006,2007 in each <option>
I get:
2004,2005,2006,2007,2003,2004,2005,2004,2005,2006,2007 in each <option>
 
     
    