Well not sure I understand the first part, but if you have a form that
passes a LIST of song titles via list element to the action page
You can check the DB prior to doing the insert to check if it exists or not.
--- Form Action --
<cfquery name="qCheckDB>
........
</cfquery>
<!--- If record does not exist do insert --->
<cfif qCheckDB.recordcount eq 0>
<cfquery name="qInsertSong">
...
</cfquery>
<!--- Get Identifier --->
<cfquery name="qGetMaxID">
Select ID from current_week where song_title eq '#item#'
</cfquery>
<!--- Do what eveer else you need with this ID and song_title --->
</cfif>
-----Original Message-----
From: Bob Imperial [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 10, 2007 6:00 PM
To: CF-Talk
Subject: need insert help please
First off...shouldn't you all be out doing something other than working? ;-)
Since you're not out somewhere having way too much fun, I could use some
enlightenment here.
I have a form passing multiple values via some checkboxes, I think I've got
the insert down ok for that with the following: I'm working with MySql and
the week_of field I have set to unique in the db.
<cfloop list="#Form.songTitle#" index="item">
<cfquery name="current_week" datasource="#dsdata#" username="me"
password="mypwd">
INSERT INTO current_week (song_title)
VALUES ('#item#')
</cfquery>
</cfloop>
My question comes in with a form field that only needs to be inserted once
for each group of songs, this value is also being passed via the form, how
would I go about handling this? To muddy this up a tad more, I have a second
for that handles song docs that need to be inserted and associated with the
week_of insert from the first insert statement. Any help would of course be
greatly appreciated! I work alone so my only source for
feedback/help/direction is this and a few other lists.
Thanks! Bob
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
The most significant release in over 10 years. Upgrade & see new features.
http://www.adobe.com/products/coldfusion
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:272286
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4