This should do what you want:
<cfquery name="getTrees" datasource="test">
select common_names
from trees
</cfquery>
<select>
<cfoutput query="getTrees">
<cfloop index="i" list="#getTrees.common_names#">
<option>#i#</option>
</cfloop>
</cfoutput>
</select>
----- Original Message -----
From: "Shirley" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, September 20, 2002 3:54 AM
Subject: Looping
> Hello,
>
> I have a field that stores info in a comma-delimited format.
The field
> is named Common_Names. I'll use three records from this field
as an example:
>
> Tall Whitetop, Tall Pepperweed, Perennial Pepperweed
> Sycamore Maple
> Porcelainberry, Amur Peppervine
>
> After querying the database, I want to loop over these records
and
> output them in the following format, so that I can use them in
a Select
> List:
>
> Tall Whitetop
> Tall Pepperweed
> Perennial Pepperweed
> Sycamore Maple
> Porcelainberry
> Amur Peppervine
>
>
> I'm having problems inserting a line feed. The following code
strips out
> the commas, but it doesn't insert a line feed. I end up with:
>
> Tall Whitetop Tall Pepperweed Perennial Pepperweed
> Sycamore Maple
> Porcelainberry Amur Peppervine
>
>
> <CFSET CRLF = CHR(13) & CHR(10)>
> <CFOUTPUT QUERY="getcommonnames">
> <CFSET COMMONLIST = Replace(Common_Names, ",", "#CRLF#",
"ALL")#>
> #COMMONLIST#<br>
> </CFOUTPUT>
>
> I appreciate your help.
>
>
>
>
>
>
>
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists