Re: Avoid inserting a duplicate record on page submit?
- From: "planetthoughtful" <planetthoughtful@xxxxxxxxx>
- Date: 29 May 2006 17:11:41 -0700
Dale wrote:
If, in the normal course of business, you add duplicate data to the table,
how do you know which to retrieve later?
Hi Dale,
Lol, I'm surprised this has become such a difficult issue, and that
no-one seems to want to touch my original question, despite it being
extremely legitimate in web design.
Oh well. Cough. Hmmm. Imagine, if you will, a simple web app used to
record activity. Imagine then, that you may perform the same action on
the same task several times. Imagine also that you as a developer have
been asked to build an interface that allows 'type-click-click-submit'
functionality (one text box, two list boxes and a submit button) and,
very importantly, that a user might legitimately record exactly the
same information several times in a row.
Now, imagine that all that's really going to be used out of this is a
count of records per activity, per task, per user id, per day.
Now, just for the sake of the argument, and without running off on a
'unique key! unique key!' tangent, how would you minimize the
opportunity for accidental insertion of duplicate records by a page
refresh?
I've already explained how I would achieve this in PHP. You will see
the "entrypage.php --> processpage.php --> entrypage.php" technique
used a lot on sites for inserting blog comments, for example - where a
page refresh might otherwise insert a duplicate comment, but where
multiple comments by the same person is very normal.
I agree, in principle, that a unique key would have been an ideal
solution, if it were applicable. But, sadly, unless someone can see
something I'm missing, it's not.
Much warmth,
planetthoughtful
---
"Lost in thought"
http://www.planetthoughtful.org
.
- Follow-Ups:
- References:
- Avoid inserting a duplicate record on page submit?
- From: planetthoughtful
- Re: Avoid inserting a duplicate record on page submit?
- From: planetthoughtful
- Avoid inserting a duplicate record on page submit?
- Prev by Date: Re: C# stl
- Next by Date: Re: What wrong with this code ?
- Previous by thread: Re: Avoid inserting a duplicate record on page submit?
- Next by thread: Re: Avoid inserting a duplicate record on page submit?
- Index(es):
Relevant Pages
|