I am trying to create a drop down box that will display a list of names from a database. The problem is that there might be many different records with the same name in the database with each record having a uniqueID. Here is the code I have so far.
It doesn't matter which record is used for the DistrictName/DistrictID values as long as only one DistrictName/DistrictID is shown in the drop down box.
Sample data:
DistrictID DistrictName
1354 Los Angles
5637 Los Angles
4533 Los Angles
6763 New York
4654 New York
6743 New York
The drop down box would only show Los Angles and New York. It doesn't matter which record is shown.
Code:
<cfquery name="qDistrictNames">
select * from District
</cfquery>
<select name="DISTRICTID">
<cfoutput query="qDistrictNames">
<option value="#qDistrictNames.DistrictID#">#qDistrictNames.DistrictName#</option>
</cfoutput>
</select>
It doesn't matter which record is used for the DistrictName/DistrictID values as long as only one DistrictName/DistrictID is shown in the drop down box.
Sample data:
DistrictID DistrictName
1354 Los Angles
5637 Los Angles
4533 Los Angles
6763 New York
4654 New York
6743 New York
The drop down box would only show Los Angles and New York. It doesn't matter which record is shown.