I am getting strange inserts every once and while. Not all the time, it
has only happened 3 times in the last 4 months. What is happening is
somehow people are getting two (one time a person got 40+) inserts into the
table when they should only get one insert. Tonight i added a <CFLOCK>
around the entire process, but im not sure if that will help.
Why, or how could the insert run more then once?
Is there a better way to write the following code?
<!--- check to see if the user is in the table --->
<cfquery name="employeejobcheck" DATASOURCE="#dsn#" dbtype="ODBC">
SELECT JOBNUM, EMPLOYEENUM, LOGOUT, LOGIN
FROM ACTIVITYLOG
WHERE (JOBNUM = #FORM.JOBNUM#) AND (EMPLOYEENUM = #FORM.EMPLOYEENUM#) AND
(LOGOUT is null) AND (LOGIN is not null)
</cfquery>
<!--- if the user is not in the table insert them --->
<cfif employeejobcheck.recordcount eq 0>
<cfquery DATASOURCE="#dsn#">
INSERT INTO ACTIVITYLOG(
ACTIVITYDESCRIPTION,ACTIVITYID,COSTPERHOUR,JOBNUM,EMPLOYEENUM,EMPLOYEENAME,LOGIN)
VALUES
('#ACTIVITYLOOKUP.ACTIVITYDESCRIPTION#','#ACTIVITYLOOKUP.ACTIVITYID#',#ACTIVITYLOOKUP.COSTPERHOUR#,#FORM.JOBNUM#,#FORM.EMPLOYEENUM#,'#FORM.EMPLOYEENAME#',#NOW()#)
</cfquery>
</cfif>
Thanks,
Chad
______________________________________________________________________
Dedicated Windows 2000 Server
PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists