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">
WHERE email = '#email#'
<cfif verifyEmail.recordcount GT 0>
We're sorry but it appears that you have already taken the quiz.
<cfinsert datasource="theKingContest" tablename="contest">
Thanks for entering our contest
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?