how to mimic table locking from PHP?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lkrubner@geocities.com

    how to mimic table locking from PHP?

    I saw that this conversation took place on this newsgroup last year:

    From: Alex Farran <a...@alexfarra n.com>
    Date: Mon, 09 Feb 2004 15:16:51 +0000
    Subject: Re: MySQL Lock ?[color=blue][color=green]
    >> I was under the impression that MySQL has some sort of queue that
    >> prevents corruption due to multiple concurrent writes.[/color]
    >
    > If he does
    > SELECT current value;
    > INSERT record with value;
    > it is possible, if more than one person is using the system, for
    > multiple users to read the same current value and so insert the same
    > value.
    > Without using triggers or subselects I'm not sure how you could do it
    > reliably.[/color]
    ..
    ..Um, LOCK TABLES?
    ..
    ..http://www.mysql.com/doc/en/LOCK_TABLES.html
    ..
    ..If you can't do that for some reason, you could always implement your
    ..own locking mechanism around the PHP that executes the query.

    I'm sure a lot of people do this in PHP, and I'd love to hear some
    approaches that have been tried, and what works. Is there a concensus
    about what the best model is?

Working...