$result = mysql_query(select distinct country from search);
Janet
- Original Message -
From: Chris Payne [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 16, 2002 1:29 PM
Subject: [PHP-DB] Unique Results?
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
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]