Unique Results?
| From: | Chris Payne | Date: | Wed, 16 Jan 2002 21:29:08 +0000 |
| Subject: | Unique Results? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-15896@lists.php.net to get a copy of this message | ||
Hi there everyone,
(Sorry if you got this twice, I don't think my mail server posted it earlier).
I use the following code to populate a dropdown box from a MySQL database:
$db = mysql_connect("localhost","^^^","^^^");
mysql_select_db("mydb",$db);
$result = mysql_query("select country from search");
if ($result)
{
echo "<SELECT NAME='country'>";
while ($myrow = mysql_fetch_array($result))
{
echo "<OPTION VALUE=\"".$myrow["country"]."\">".
$myrow["country"]." </OPTION> ";
}
echo "</SELECT>";
}
However, this database has multiple country names the same (Aswell as unique ones) how can I display
just ONE of each entry? IE: say there are 5 africa, 3 britain etc ..... I only want the list to
show 1 of each and not 5 and 3 and so on - how is this possible? Please help :-)
And thank you to everyone who helped me with an earlier enquiry, it's very appreciated :-)
Chris Payne
www.planetoxygene.com