Try this:

<cfquery name="List" datasource="database" dbtype="ODBC">
         SELECT      env
         FROM        prefs
</cfquery>

<cfset EnvList = #ValueList(List.env)#>

<cfcookie name="Display" value="#EnvList#" expires="NEVER">

<cfloop list="#Cookie.Display#" index="Env">
    <cfoutput>#Env#</cfoutput><br>
</cfloop>


----- Original Message -----
From: "John Gedeon" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, October 08, 2002 12:14 PM
Subject: Re: Reading in database and setting a cookie with the
results


> <cfloop query="List"> should loop through all the records
returned by the
> List query...
> does that help?
> John
>
> At 09:59 AM 10/8/2002, you wrote:
> >Hi,
> >
> >I have a database with only two fields. I would like to read
the database
> >and shove the results of "env" into a cookie. I tried <cfloop
but I only
> >get the first occurence?
> >
> >The "env" field in my database contains 550 entries. I want
the results
> >into a cookie as a comma delimited string.
> >
> >Example:
> >
> >file1
> >file2
> >file3
> >file4
> >file5
> >
> >Cookie contents: file1,file2,file3,file4,file5
> >
> ><cfquery name="List" datasource="database" dbtype="ODBC">
> >         SELECT      env
> >         FROM        prefs
> ></cfquery>
> >
> >         <cfcookie name="Display" value="#List.env#"
expires="NEVER">
> >
> ><cfoutput>
> >#COOKIE.Display#
> ></cfoutout>
> >
> >
> >
> >---------------------------------------------------
> >Colonel Nathan R. Jessop
> >Commanding Officer
> >Marine Ground Forces
> >Guatanamo Bay, Cuba
> >---------------------------------------------------
> >
> >
> >
> >
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Reply via email to