[wd_asp elements=’search’ ratio=’100%’ id=1]

Stop duplicates in dropdown box

11th March 2014

Php - Miscellaneous

php codehaven

This code stops duplicates appearing in your dropdown boxes.
";
$sql = "SELECT tagname FROM tags order by tagname"; // new options mysql
$resulta = mysql_query($sql);
echo ""; //or put whats in the database in select options
while ($rowa = mysql_fetch_array($resulta)) {
//prevents dupes in dropdown
$tagname= $rowa['tagname'];// get all results
if($tagname != $row['tagname']){ //filter results
// end of prevent dupes

echo ""; //output filtered results
} //end while
} //end while
echo "";
}
?>