still don't see how I can create a list dynamically.
I have a form with series of repeating fields from which the user can update
a class schedule
Example:
Class: Beginning Guitar [text box]
Desciption: Learn how to ... [select box]
Sessions: 4
Session Month [drop-down] Day [drop-down] Class Start [drop-down] Class End
[drop-down]
1 10 8 1PM
3PM
1 10 15 1PM
3PM
1 10 22 1PM
3PM
1 10 29 1PM
3PM
2 ...
2...
I would like the user to be able to update at whim and to loop through these
records and update them.
The record ID is in a hidden text box.
When I get to the update section I should be able to put the IDs in a list
and then from that list get a LISTLEN
and do a
<cfloop list="#dateList#" index="dateSessions">
<cfquery name="getSessionDays" datasource="">
UPDATE classDates
SET
classDay='#FORM.classDay#',
classSession='#FORM.classSession#',
classDates='#dateSessions#',
classStart='#FORM.classStart#',
classEnd='#FORM.classEnd#'
WHERE ID IN(#dateList#)
</cfloop>
yes with cftransaction,cftry and cfcatch :-0
thx,
gil
-----Original Message-----
From: Gyrus [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 15, 2003 7:17 PM
To: CF-Talk
Subject: Re: list, adding to
At 19:01 15/10/2003 -0400, you wrote:
>UPDATE
>SET
>WHERE ID = ID_FROM_LIST
>
>Should be able to do a <cfloop list> but I'm not able to create the list.
>I'm missing an important point somewhere otherwise I'lld see it.
Are you looking for this?
UPDATE table
SET fields = values
WHERE ID IN (3,6,8,13)
The IN operator takes a comma-delimited list in parentheses (remember to
quote each value if they're strings). If you're coming from a form,
presumably items are being selected in a drop down? If you have the ID of
each item in each OPTION tag's VALUE attribute, you should be able to do
this:
UPDATE table
SET fields = values
WHERE ID IN (#form.dropDownField#)
>Example problem2:
>
>I have a calendar script, would like to flag certain days and would like
to
>be able to generate the list from a query.
>
>SELECT dates
>FROM somewhere
>WHERE dates LIKE '10%'
>
>and do something along the line of #ListAppend(myDateList,dates)#
Not sure what you're trying to do here, but.... Does ValueList() help?
Check docs for info on this CF function - it takes a column in a query
recordset and turns puts all the values in the column into a list. Very
handy!
HTH,
Gyrus
[EMAIL PROTECTED]
http://norlonto.net/gyrus/dev/
PGP key available
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

