cancer10
09-24-2008, 09:25 AM
Hi,
I am using PHP/MySQL to build an application.
My application is a multi-user application where in more then 1 people will be entering data.
There is an employee table in my database tbl_employee which has a serial_no column. This column holds the serial nos of all the employees in the format of EMP00XX where XX is the row count of that table + 1. For example: tbl_employee has 50 records, so if someone adds a new employee, the serial # for the 51th row will be something like EMP0051.
Now Problem:
If there are 5 people doing the addition of employee simultaneously then all of those 5 people will be adding the next employee code as EMP0051.
Question:
How can we prevent from inserting duplicate employee nos. under such scenario?
Plz Help :)
I am using PHP/MySQL to build an application.
My application is a multi-user application where in more then 1 people will be entering data.
There is an employee table in my database tbl_employee which has a serial_no column. This column holds the serial nos of all the employees in the format of EMP00XX where XX is the row count of that table + 1. For example: tbl_employee has 50 records, so if someone adds a new employee, the serial # for the 51th row will be something like EMP0051.
Now Problem:
If there are 5 people doing the addition of employee simultaneously then all of those 5 people will be adding the next employee code as EMP0051.
Question:
How can we prevent from inserting duplicate employee nos. under such scenario?
Plz Help :)