Quote:
Originally Posted by guelphdad
You should absolutely not do the above suggestions if you are using a database. If you are using mysql then you should use an auto_increment column. You would use last_insert_id() to fetch the last row inserted into that column.
If you are using a database other than mysql then you should look into sequences.
If you were to do the above suggestions then you would have to guarantee you were always the only user of the database, otherwise you could insert a number and before you insert it or update it another user could use the same value to update a table. Your value would then be wrong. Auto_increment and sequences avoid this problem.
|
Whilst these are valid comments in the right cercumstances, I think you have misunderstood the requirements in this case and might be confusing the originator of the thread.
The originator of the thread is not looking, or so I assumed, to insert any new rows. They just want a record of the last number they used.
If SephirGaine would like to elaborate on their requirements then the suggestions might need to be reviewed.