[thelist] cfloop

Palyne Gaenir palyne at sciencehorizon.com
Wed Jul 19 04:30:39 CDT 2000


Could have sworn I saw something vaguely similar to this topic go by 
not long ago, but scrolled through messages and couldn't find it.

I have a system where the admin gets a list of records and for each 
one should have the option to change 'status' to 'live'.  I want to 
just make a checkbox for this on each record-row-output where if it's 
NOT checked (the default), the status for a record doesn't change, 
and if it is, then status=live is updated for that record.  It has to 
go through all these different records though.  It sounds like 
something CFLOOP might do, which I haven't used much so far, but in 
Forta's book most of the loop examples demo'd are populating data in 
a page from a db -- not populating a db from a page.  The closest I 
could find was:

"This example loops through a user-supplies list of titles, 
displaying them one at a time:"
<cfloop index="title" list="#FORM.titles#">
<cfoutput>
Title: #Title#<br />
</cfoutput>
</cfloop>

Er... if I used this for a CFUPDATE or SQL UPDATE would my index be 
the primary key column for that table?  How would the statement be 
written to update the 'status' field for all the records in the list 
with boxes checked?

<form etc.>
<cfoutput a query with multiple records>
<ckbox status> edit_link #id# #title# #author# del_link
<ckbox status> edit_link #id# #title# #author# del_link
<ckbox status> edit_link #id# #title# #author# del_link
<ckbox status> edit_link #id# #title# #author# del_link
</cfoutput>
<submit button for updating status fields>
</form>

Many thanks.
Palyne





More information about the thelist mailing list