Solved

Double entries when inserting a new records...

Posted on 2002-07-19
4
134 Views
Last Modified: 2013-12-24
Hi Guys,

I have problem with inserting new records.  The problem is weird I must say.  Sometimes I get a double entries, sometimes I dont.  This is making me crazy as I never know when its gonna come out double again.

First of all, I checked on my code, its not running twice (most of friend told me this!).  

Secondly, I tried to query my table before inserting a new record, if found a same record (with the same batch of data), then delete it (not working too!!)

Thirdly, I put a <cflock> in all my insert statements, and it doesnt seems to work too.

So my question is, can anyone tell me what's going on here and how can I solve this as it comes and go, comes and go, unpredictable!

Thanks!
0
Comment
Question by:magicwizard
4 Comments
 
LVL 6

Expert Comment

by:dash420
Comment Utility
There is one chance that u may click save button twice. That why may two same record got inserted. u can do one check before insert into table. just check already the record exist. means selects the count(1) form table where all the matching fields i.e. all form value.
 
0
 
LVL 17

Accepted Solution

by:
anandkp earned 100 total points
Comment Utility
HI there,

u can also chk for the following :

u may have input type submit - right ???
now just chk if u have a onclick / onsubmit function being called for this image.

& if u r having some javascript validations for that page ... then chk at the end if u have written ...
frm.submit()

if this has happend - the form gets submitted twice -
once thru input type submit &
secondly thru javascript frm.submit()

==========================================================

if what ive written above is not there - then pls chk what dash420 has written ...

else revert back with ur comments

K'Rgds
Anand
0
 
LVL 5

Expert Comment

by:Yog
Comment Utility
are you using cftransaction at all ?
0
 

Author Comment

by:magicwizard
Comment Utility
I found the problem was with the javascript.  But it still appear to be weird to me as I usually does submission using the javascript notation docuemnt.formName.submit() and it doesn't give me my current problem.

Anyway, I will accept this as the answer as it does solve my problem for the time being.

Thanks guys!!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now