Performing database transaction
Posted: Sun Apr 29, 2007 8:23 pm
Hi!
I created a booking registration form the users fills up. Each information entered must be inserted in the database with a unique id. I formulated an id like BK00001-07.
WHERE:
BK is the prefix
00001 is a series that is stored in the database
07 is the current year
Before inserting the record, I get the next counter in the table named ba_booknoprefix. But since the script is for multiple users,I believe duplicate ids are possible to generate. How can I avoid this scenario? Can I use database transactions? Please give me example scripts.
Thank you!
I created a booking registration form the users fills up. Each information entered must be inserted in the database with a unique id. I formulated an id like BK00001-07.
WHERE:
BK is the prefix
00001 is a series that is stored in the database
07 is the current year
Before inserting the record, I get the next counter in the table named ba_booknoprefix. But since the script is for multiple users,I believe duplicate ids are possible to generate. How can I avoid this scenario? Can I use database transactions? Please give me example scripts.
Thank you!