this is a good technique - and you can just delete the record if the user "cancels" - would probably still need the automated job to kill unused records created by power outages, browser closures, etc.
I try not to modify the tables unless I really need to, so another approach would be to pull the last ID from the file and assume that "lastID + 1" will be used - if after the record is filled in and submitted, check the last ID from the file again - if it's the same then everything is ok - if not, then update the ID field to the new "lastID + 1" and inform the user that the ID changed. IIRC, there is something in mySQL for doing this, but you still have to protect yourself from others updating the file. Umair Vatao wrote: > > > Ok > > here is a solution if you must show the correct id on form. > > when someone open the form, just create a blank record (or fill some fake > values in not null fields) and then pull its ID on screen... > > upon successful submission of form, just update that record. > > But this may create unnecessary blank records, so you need to setup an > autometic job, which searches for such fake records and keep deleting them > every night etc > > Umair > > On Wed, Apr 14, 2010 at 1:02 PM, imran shafiq <[email protected] > <mailto:jibreel_amin%40yahoo.com>>wrote: > > > > > > > Dear Exerts > > > > I need to display the Customer_ID on the form when user enter the > info.e.g. > > if 100 records are saved when user goto form to enter customer info the > > record no 101 is shown > > But you know that when user submit the form then auto increment field is > > incremented 1 > > Customer > > Customer_ID Auto_increment > > First Name > > Last Name > > Address > > Phone > > > > What is the solution? > > > > Imran Shafiq Khan > > > > [Non-text portions of this message have been removed] > > > > > > > > [Non-text portions of this message have been removed] > > [Non-text portions of this message have been removed]
