Re: [PHP] LOCKS???

[email protected] (Adam Jon Richardson)
Newsgroups php.general
Message-ID <CAJzDObcsKZorGj1yJd1iZJy_i2fZUUu87ukr+hVH_wo5docxOg@mail.gmail.com>
On Tue, Nov 29, 2016 at 2:09 PM, Stuart Dallas <[email protected]> wrote:

> On 29 November 2016 at 16:51:24, Tedd Sperling ([email protected])
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.