Jump to content

[SOLVED] Poplulate dropdown menu without duplicates


brooksh

Recommended Posts

I've been searching to figure out how not to have duplicates in a dropdown menu populated from my database. This is what I have, but how do I change it to get rid of duplicates?

 

<?php
$result = mysql_query("SELECT City FROM residential order by City");
echo "<select MULTIPLE NAME=\"City_code\">";
while($row = mysql_fetch_array($result)){

echo "<option name=\"City\" value=\"$row[City]\">$row[City]</option>";

}
?>
</select>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.