Was wondering if anyone could help.
I`m querying a mysql database with
"SELECT make FROM cars ORDER BY make ASC"
this returns all the makes of cars in a database like
Ford
Ford
Ford
Seat
Vauxhall
Volvo
Volvo
into a drop down box
<?
$link = mysql_connect($host, $user, $password);
$query = "SELECT make FROM cars ORDER BY make ASC";
$results = mysql_db_query ($dbname, $query, $link);
echo" <select name=\"make\" onChange=\"submit()\"> ";
$idname = "make";
echo mysql_error();
if (mysql_Numrows($results)>0)
{
$numrows=mysql_NumRows($results);
$x=0;
while ($x<$numrows){
$theId=mysql_result($results,$x,$idname);
$theName=mysql_result($results,$x,$idname);
echo "<option value=\"$theId\">$theName</option>\n";
$x++;
}
}
echo "</select>";
?>
what i`m would like to know is, how can i strip out duplicates so i just have
Ford
Seat
Vauxhall
Volvo
Thanks