|
Hi
can a php page be used by 2 people at the same time or will one page load be completed before another person can call it?
I have a registration form which, when processed will update several tables at once. Nothing new there, but ive come accross something which i feel could ultimately be a problem and that is a very common procedure. it goes like this -
my user table has a userid field which is auto increment, and my images table has a userid id field which is not auto increment. During a transaction i add a row to my user table, which auto increments the userid column, then before i confirm the transaction i need to enter the user's image information and tie it to the user table with the userid which has just been assigned to the user table.
my transaction would look something like this -
BEGIN TRANSACTION
ENTER USER TABLE INFO
SELECT RECENT USERID FROM USER TABLE
(increment userid as the entry above hasnt been confirmed yet)
$userid=($userid+1)
ENTER IMAGES TABLE INFO WITH $userid as key
CONFIRM OR DECLINE TRANSACTION
What would happen if 2 people submitted their registration forms within nano seconds of one another and the SELECT USERID query of user 2 retrieved the userid of user 1 whos transaction had been confirmed between the ENTER USER TABLE query and the SELECT USERID query of user 2?
I hope this makes some sense. Its a very simple concept that i have difficulty explaining.
thanks in advance
mark
Last edited by hiptobesquare; 02-27-2008 at 11:12 AM..
|