flash – Why do duplicate (and unwanted) inserts occur in mySQL? – Education Career Blog

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

,

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?

,

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

,

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.

Leave a Comment