select distinct, explode and put the first values in a drop down
<p>I have these values in a table: I want to get only the first values into a drop-down list where there will be no duplicates in terms of the first values. this code works well but shows duplicates. Any help? Thanks.<br>
media > audio > country<br>
media > video > country<br>
media > video > country<br>
media > other > gospel<br>
apparel > female > adult<br>
apparel > male > adult     </p>

<pre><code>$sqlbrand = "SELECT DISTINCT Product_Type FROM products ORDER BY Product_Type";



                $rsbrand = mysql_query($sqlbrand);



                while($brand = mysql_fetch_array($rsbrand))

                    {   

                        if($brand['Product_Type'] != '')

                        {                   

                        $str = $brand['Product_Type'];

                         $category = explode('&gt;', $str);

                         $catName = $category['0'];

                            echo "&lt;option value=\"".$catName."\"&gt;".$catName."\n  ";

                        }

                            else

                        {

                        }

                    }
</code></pre>
