Re: loop over query
chrispilie wrote:
> AH... Lazy copy and paste error. The UPDATE worked. Time for some coffee!
I presume that means you correct your INSERT|UPDATE logic so that you
get a different value each loop? Because in your original post, the
logic would produce the same value for every record put|changed in the
database.
<CFLOOP INDEX="Update" LIST="#FORM.Updated#">
<CFQUERY Name="#Update#" DataSource="#db#">
INSERT INTO QTYTracking (Updated)
VALUES ('#FORM.Updated#')</CFQUERY></CFLOOP>
</cfif>
If form.Updated equaled the list 'red,white,blue' Then three values
would be put into the database, but the 'Updated' column of all three
would equal 'red,white,blue'. I would usually expect a loop like this
to put three separate values and thus it would look something like this.
<CFLOOP INDEX="Update" LIST="#FORM.Updated#">
<CFQUERY Name="#Update#" DataSource="#db#">
INSERT INTO QTYTracking (Updated)
VALUES ('#Update#')</CFQUERY></CFLOOP>
</cfif>
But maybe that is not the desired result.
|