Hi Ashley, Insert records into a table with a primary key that you define, not an autoincrement field. When 2 people try to insert a record with the same primary key, one will fail, the other will succeed.
The one that fails will poll the database until the other record successfully completes the insert. Regards, John Ashley M. Kirchner <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > (PHP-DB folks, ignore this top question - unless you want to answer) > > Which type of DB/Table provides table locking while a process is > altering data? I don't care for locking while using SELECTs, but I do > need locking when something's being INSERTed or UPDATEd, so I won't get > two processes trying to do the same darned thing at the same time. > > > > (MySQL folks, ignore this bottom question - unless you want to > answer) > > I'm somewhat lost on how to do the following: > > I'm trying to go through a table and check for a particular > information. If it doesn't exist, then go ahead and issue an INSERT > with the relevant data. The next time another process comes along, > it'll obviously find the information and issue an UPDATE instead. But, > what happens if I get two processes running at the same time, trying to > find information that does not exist yet? > > If both issue a SELECT and find the information not there, both will > try to issue an INSERT, where really I want one of those processes to > wait for the first one to finish doing whatever it needs to do, prior to > continuing. (all of this is being done in PHP by the way). Does anyone > have any suggestions for this scenario (or am I just blowing smoke out > my arse and there's something else, internally, that I'm not aware of?) > When (and how) to issue some sort of "wait" state for one process while > the other's finishing what it needs to do, then restart the second > process (which should re-check for existing information, and not blindly > issue another INSERT right after the first one). > > -- > W | I haven't lost my mind; it's backed up on tape somewhere. > +-------------------------------------------------------------------- > Ashley M. Kirchner <mailto:[EMAIL PROTECTED]> . 303.442.6410 x130 > IT Director / SysAdmin / WebSmith . 800.441.3873 x130 > Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave. #6 > http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A. > > -- 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]