I have a question I think involves sessions. My problem I'm thinking is...
1) I have someone log into my application. 2) The user has to add his "username","password". 3) My application checks the database to see if the username/password already exists. 4) My application returns, "username"/"password" does not exist..."username/password" added to database.
MY QUESTION. what if 5 people are logging in and checking the data at the same time. Do sessions prevent more than one user viewing or modifying the data in a single instance? I want to prevent someone adding a password that doesn't exist at the same time someone may be adding that password.
Please help me understand this process, if sessions don't take care of that and I don't have to worry then how does one implement code to prevent an error.
Thanks for all the replys. Synchronized connection methods it is. Time to do more homework on this.
Best Regards, Hassan
Joined: Mar 02, 2006
Not all db interaction methods need to be synchronized. Only those where you believe there will be a probable conflict, as in the posted example. Also, as stated above, using transactions will also prevent alot of problems. If you are using the InnoDB engine in MySQL then, you have transaction support. [ June 13, 2006: Message edited by: Martin Simons ]