A user makes a booking. They enter their name, the Pickup address and a Dropoff address and a time of pickup.
If, the user has an internet problem and their form doesn't seem to send, they press the submit button a second time, I often end up with 2 entries both the same in the database. Sometimes, Date_added column could change by amount of seconds because of when user clicks submit button.
I am trying to stop 2 entries being added to the database.
How do I check the database to see if their first submit was a successful entry into the database and stop a second row/record being added?
I was going to try using UNIQUE, but the user books trips and other times and also other users could use the same address's at times.
My columns names are: Date_added, Username, Pick_up_Address, Drop_off_Address, PU_time
How do I check the database to see if it's not a duplicate entry about to be added, that is only different by under a minute.
I don't know where to start with this or how to do it.
I tried UNIQUE in query but this would not work as other users would use the address's.