Does get_tobacco contain an ID field?  If you're comparing two sets of ID's, my 
CF_Venn tag can do that:

CF_Venn ListA="#ValueList(Contents.ContentsID)#" 
ListB="#ValueList(get_tobacco.theID)#" AandB="matches">

The heart of the relevant code is simply:
   <cfset AandB = "">
   <cfloop list="#ListA#" index="Elt">
        <cfif ListFindNoCase(ListB,Elt)>
            <cfset AandB = ListAppend(AandB,Elt)>
        </cfif>
    </cfloop>

-David

On Monday, March 19, 2001 5:35 AM, Jon Tillman [SMTP:[EMAIL PROTECTED]] 
wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I have a string of numbers, seperated by commas, stored in a text field in a
> table, call it tblItem.
> These numbers each correspond to a primary key in tblContent.
> I build a select box by looping over all the primary keys in tblContent, like
>
> this:
>
> <cfquery name="get_content" datasource="#application.dsn#">
> SELECT  *
> FROM    TblContent
> </cfquery>
>
>         <td><select name="Contents" size="5" multiple>
>             <cfoutput query="get_content">
>             <option value="#ContentsID#">#ContentsName#</option>
>             </cfoutput>
>             </select>
>         </td>
>
> Now, what I want to do is to add a bit of code to this that will check for a
> match between the ContentsID from my option and any of the values in the
> string from this query:
>
> <cfquery name="get_tobacco" datasource="#application.dsn#">
> SELECT  *
> FROM    tblItem
> WHERE   ItemID = #url.ITEM#
> </cfquery>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to