> > was finding that due to MySQL queuing requests or something, that sometimes > > a > > new SELECT request was coming in the time between the SELECT and UPDATE > > commands from the other process
Without black magic or some other application of the dark arts, you're NEVER guaranteed that your sequence of queries won't be interrupted in some way by another process. >From reading the text that Andrew linked to, it seems like this oughtta work: LOCK TABLES table WRITE SELECT yada yada UPDATE yada yada UNLOCK TABLES PROCESS TASK etc. but it feels quite heavy-handed. I like Tim's solution (not surprising since it's more-or-less the same as the one which I posted a few days ago -- in theory, anyway ;) Its elegant in its simplicity and the way it uses the natural features of the database to get the desired result. I'd be interested in knowing how the LOCK/UNLOCK goes, though. Obviously in a multi-process environment you have to issue LOCK requests and not continue until you are successful. There would be several ways to implement that, not sure if any could be said to be better than another at this point. -s --~--~---------~--~----~------------~-------~--~----~ NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [email protected] -~----------~----~----~----~------~----~------~--~---
