|
Re: Increasing Number Generator..
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.
|