Good Day,
Can anyone help me how to delete duplicate record in a dropdown list? I have a database with the column "material type" and "material model". For every material type there are a lot of model, so everytime I add record to the database, the column material type will have duplicate records.
Example:
Material Type Material Model
Gatsby wax
Gatsby clay
Gatsby gel
When I query the database, all gatsby record will appear in the dropdown list wherein I just want one record of gatsby to appear, please help me how to eliminate duplicate records with this.
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("ppic", $con);
$sql="SELECT idNumber, mType FROM tableItem";
$result= mysql_query($sql);
$options="";
while ($row=mysql_fetch_array($result)) {
$id=$row["idNumber"];
$thing=$row["mType"];
$options.="<OPTION VALUE=\"$id\">".$thing.'</option>';
}
?>
<OPTION VALUE=0><select>
<?php echo $options ?>
</select></td>
above is the code
Hope to read your reply soon.
Thank you very much