View Full Version : retrieve same number

02-19-2003, 05:00 AM

i face a terrible problem!!

i want to do a registration form with a serial number, but the serial number is get from a table to generate a running number, then add 1 to increase the number, but now my problem is user may get two same seial number when user save the record at the same time.

how to solve??!!!

02-19-2003, 05:47 AM
Is the number generated after the user submits the form?
If so, I suppose its possible that two users could it the button at the same time, but it seems highly unlikely. I mean they'd have to hit the button at the same exact milisecond and have the same internet connection and the same path the to the server. The database can runs commands in nanoseconds, so it would be nearly impossible to get the timing right for a duplicate to happen. Unless I miss understand what you are saying.

02-20-2003, 12:29 AM
If you're using your autoincrement (primary key) field, here's the solution - I had to use this yesterday, it's very simple!


I used the code provided there with almost NO modification. Works great.