Hey guys...
I'm working on a contest which will use a database. The user will enter their information and the answers (multiple choice) then this information will be written to a database.
I need to know about cflock, which I assume will allow me to lock a transaction to prevent information becoming corrupted. Here's the code that I'm using to write to the database. First I select from the database where email EQ the email the user entered to verify that they have not yet submitted answers. Then I write the information or don't based on that information:
<cfquery name="verifyEmail" datasource="theKingContest">
SELECT email
FROM contest
WHERE email = '#email#'
</cfquery>
<cfif verifyEmail.recordcount GT 0>
<cfoutput>
We're sorry but it appears that you have already taken the quiz.
</cfoutput>
<cfelse>
<cfinsert datasource="theKingContest" tablename="contest">
<cfoutput>
Thanks for entering our contest
</cfoutput>
</cfif>
Can you guys do two things for me?
-= Look over this code and make sure it's good quality.
-= Tell me how to lock it so that only one person can submit at a time?





Bookmarks