views:

59

answers:

3

The strangest thing has occurred with one of my apps (Flash/Coldfusion/mySQL). I use a simple INSERT statement to save member details into my table. The table has a Primary Key on the memberID. Recently, one of my entries was saved multiple times (not supposed to happen). The datetimestamp shows the save occurred at the identical time. This has never happened before. I've read on Stackoverflow that there are alternatives to INSERT e.g. REPLACE INTO, but I'm wondering why this would have occurred in the first place?

Any insight would be greatly appreciated.

Thanks.

Jason

+1  A: 

Are you saying MySQL allowed you to save multiple records with the same PK, and the PK column is actually defined as PK in MySQL? I highly doubt this could happen.

Instead, perhaps you are querying the table with a JOIN that is giving you multiple rows back?

RedFilter
No, no, RedFilter. Multiple entries with autoincrement PK values. I'm going to look into Marc Escher's multiple click hypothesis. Thanks for your help.
Jason
+1  A: 

Is your app allowing double clicks or other multiple simultaneous submits?

Joshua Cyr
Hey Joshua. Yeah, I'm going to look into this. Question, can you think of any other way multiple simultaneous submits could occur (other than mouse clicks)? Thanks.
Jason
Perhaps a bad proxy server or caching agent on the browser?
Joshua Cyr
A: 

If you check your webserver logs, you'll likely see two entries for your "submit" action URL. This is almost always caused by your app not preventing duplicate form submission. So if a user clicks really fast on the submit button multiple times, the form will submit multiple times.

marc esher
Hey Marc. Yeah, I'm going to run a test on this. I guess I didn't consider since the person who reported the issue is an experienced user of my app. I didn't think she would do the double-click action. I'll let you guys know the results.
Jason