Does this help?  I use two lists instead of an array, but using two lists is
basically a two demensional arry.

I had a form that had a number of hidden input fields all called
"webfileid".  Don't worry about the attributes scope (attributes.webfileid
instead of form.webfileid).  I just scope everything as attributes in case I
need to CFMODULE at any point in the future.  Anyway when the form is
submitted since I had multiple hidden fields all named the same thing, when
I use "post" as the form's method it turns the fields into one comma
delimited list (attributes.webfileid or form.webfileid if not scoped to
attributes).  I then get all of my client id's from a query and form another
list using VALUELIST.  I then create a nested loop and input the webfile
id's and client id's into a table.  Which is basically what it looks like
you are trying to do with an array.

If you need more clarification, just email me and I will try to be more
clear.

<!--- get all client ids --->
<cfquery name="allclientids" datasource="#attributes.datasource#"
dbtype="#attributes.dbtype#" dbserver="#attributes.dbserver#"
password="#attributes.dbpassword#" username="#attributes.dbusername#">
SELECT      clientID
FROM         dbo.clients
</cfquery>
<!--- make a list of all client ids from query --->
<cfset clientidlist = valuelist(allclientids.clientid)>
<!--- outer loop is the webfile id list from the form
(attributes.webfileID)--->
<cfloop index="thiswebfileid" list="#attributes.webfileID#">
 <!--- inner loop is the length of clientidlist --->
 <cfloop index="i" From="1" To="#listlen(clientidlist)#">
 <!--- First check to see if the clientid and webfileid value pair exists in
the clientswebfile table --->
  <cfquery name="checkwebfileexists" datasource="#attributes.datasource#"
dbtype="#attributes.dbtype#" dbserver="#attributes.dbserver#"
password="#attributes.dbpassword#" username="#attributes.dbusername#">
  SELECT      clientID, webfileID
  FROM         clientswebfile
  WHERE       (clientID = #listgetat(clientidlist, i)#) AND (webfileID =
#trim(thiswebfileid)#)
  </cfquery>
 <!--- If the clientid and webfileid value pair does not exist in the
clientswebfile table add it  --->
  <cfif isdefined("checkwebfileexists.recordcount")>
   <CFIF checkwebfileexists.recordcount IS 0>
    <cfquery name="insertclientwebfile" datasource="#attributes.datasource#"
dbtype="#attributes.dbtype#" dbserver="#attributes.dbserver#"
password="#attributes.dbpassword#" username="#attributes.dbusername#">
     insert into clientswebfile(clientID,
            webfileID)
        values(#trim(listgetat(clientidlist, i))#,
          #trim(thiswebfileid)#)
    </cfquery>
   </cfif>
  </cfif>
 </cfloop>
</cfloop>

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to