How to tell between update and insert ?
I have a form where a user can enter a value, press a button and anoher input would appear, add another value, press the button again, etc. When done, he submits and I use cfloop list to insert the data into a table.
When I bring up this form again, I check to see if there are any values in the table. If they are there, I display the values in a table, one per row. At the end, I have the button again, just in case they need to add more values.
Here is the problem that I am running into and do not know how to solve. How do I know whether they added a new value, or simply changed one of the existing values ? Or what is they did both, change an exisitng value and add a new value ?
This is the code I use if they chagned an exisitng value :
<cfloop index="dateCodeID" list="#form.dateCodeID#" delimiters=",">
<cfquery name="qryUpdateDateCodes" datasource="db">
udate table
set dateCode = '#Evaluate("form.dateCode#dateCodeID#")#'
where stockScreenID = '#form.stockScreenID#'
and dateCodeID = '#dateCodeID#'
</cfquery>
</cfloop>
and I would use the cfloop list to insert a new value, but how would I know which one to use when they submit ? I do not know whether an exisitng value(s) changed or new value(s) added.
Thanks
