Web lists-archives.com

Re: [PHP] LOCKS???




On Tue, Nov 29, 2016 at 2:09 PM, Stuart Dallas <stuart@xxxxxxxx> wrote:

> On 29 November 2016 at 16:51:24, Tedd Sperling (tedd.sperling@xxxxxxxxx)
> Ok, I’ve read lot, but I still cannot get a single example of LOCK to work.
>
> As mentioned I’m pretty sure this is because you’re attempting to lock in
> one request and expect the lock to still be there in subsequent requests.
> This is fundamentally not how MySQL table locks work so you’ll need to
> implement your own mechanism.


I agree with Stuart's analysis of failure causes and potential remedies. To
test the hypothesis that the share-nothing architecture of PHP is causing
the trouble, try adding a sleep() call to the first script and then within
the interval, call the second script. The tables should be locked.

Also, in terms of reads, I would suggest you could also provide a system
status update if a user is on a screen that is displaying data and the data
has changed, as you could prompt the user to refresh the page.

Happy coding!

Adam