I am developing an online admission system with PHP
and MYSQL
database
in which i will issue a unique form number to every applicants. Please keep in mind that the following format I will follow for the number e.g. 2016-00001 means year-00001. So for the first number I will insert the value in the database then after that the form numbers will be issued.
According to my thinking following steps will be followed:
- Read form number from the form number table.
- increment the form number in the form number column.
- update the form number in the form number table.
Now I am thinking that what will happen if concurrent processes are occurred to the table, means many user access the table and read the value and update it at a same time than All of them will be assigned same form number. What steps should I follow to don't cause this problem.