delimited input cfloop
I am trying to use a list of delimited values and put it in a database. The list is setup as follows:
siteId|SiteName|siteURL|galleryURL|descript|dateAdded|type;
siteId|SiteName|siteURL|galleryURL|descript|dateAdded|type;
siteId|SiteName|siteURL|galleryURL|descript|dateAdded|type;
As you can see the values are delimited by pipe and each one has a semi-colon on the end. I have comprised the follow code that doesn't seem to work. What is wrong? (Assuming its gets passed the form.txtBox1 from a seperate script.
<cfloop index="gallery" list="#form.txtBox1#" delimiters="|">
<cfquery name="importList">
INSERT INTO gallery (siteId,siteName,siteUrl,galleryUrl,descript,dateAdded,type)
VALUES
('#listgetAt('#gallery#',1, '|')#',
'#listgetAt('#gallery#',2, '|')#',
'#listgetAt('#gallery#',3, '|')#',
'#listgetAt('#gallery#',4, '|')#',
'#listgetAt('#gallery#',5, '|')#',
'#listgetAt('#gallery#',6, '|')#',
'#listgetAt('#gallery#',7)#'
)
</cfquery>
</cfloop>
