Does the Connection ID change if I use persistent connection through PHP using mysql_pconnect()? Is it possible to retrieve CONNECTION_ID() this though PHP? -----Original Message----- From: The Tilghman [mailto:[EMAIL PROTECTED]] Sent: Monday, January 29, 2001 4:31 PM To: 'Randy Johnson' Subject: RE: Doing multiple updates web@machine:admin> select connection_id(); +-----------------+ | CONNECTION_ID() | +-----------------+ | 395 | +-----------------+ 1 row in set (0.00 sec) web@machine:admin> -- "There cannot be a crisis today. My schedule is already full." --Henry Kissinger > -----Original Message----- > From: Randy Johnson [mailto:[EMAIL PROTECTED]] > Sent: Monday, January 29, 2001 14:50 > > I have decided to implement the "soft-lock" schema below. I > cannot use the > userID as the value for the lock. Is there any other unique > number that can > be generated that I could use. I am thinking about using a > session_ID in > PHP? Any suggestions/Comments?? > > Randy > > -----Original Message----- > From: Cal Evans [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 24, 2001 4:10 PM > > My recommendation (and there are probably many people who > will disagree with > me) is to use a "soft-lock" schema. > > In your account table, add a field named lockedBy. I usually > add a field > named lockedAt also as a timestamp. > > the basic flow is this: > > 1: Check to see if the record has something in lockedBy > -NO- > 2: Update the record with your userID > 3: Check to see if there record has something in lockedBy and > it is you. > -YES- > 4: you have successfully soft-locked the record for update. > Go ahead and > make your update > 5: update the record to remove the lock. > > WARNING: This system assumes that you have control over all > processes that > access the database. If there is a chance that someone will > come in and be > able to modify the data outside of your code then they can bypass your > checks and modify the data. > > In many DBMSs (not sure yet about MySQL) record locks keep > people for even > seeing the data and some (M$ SQL) used to lock whole tables > to do a single > update. (sux big time) > > -----Original Message----- > From: Randy Johnson [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 24, 2001 2:48 PM > > I am creating a mock site that has a money balance that > people can login > and pretend to pay money for stuff online via my site. > > I am using php with mysql to implement this. > > How do I make sure that a balance for a particular account is > (locked) so > only 1 spend for that account can happen at one time? > > for example my php script grabs the balance from the payer account and > receiver account. How do I make sure that the balance is locked so the > balance is read before the updated transaction occurs causing > the person to > spend money that he/she doesn't have. > > I hope I have provided enough explanation for you guys to > point me in the > right direction. > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]