Re: Locking mysql tables with PHP
| From: | Tony Crockford | Date: | Tue, 25 Nov 2003 13:12:59 +0000 |
| Subject: | Re: Locking mysql tables with PHP | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-170870@lists.php.net to get a copy of this message | ||
On Tue, 25 Nov 2003 13:50:36 +0100, Marek Kilimajer <kilimajer@webglobe.sk> wrote:
Tony Crockford wrote:
get a numeric value from a MySQL table, do a calculation, then on another PHPpage update the numeric value in the table. what I don't want is anyone else getting the same number from the table before I've updated it. what PHP would you use to do this?
Oh, okay. is there a way I can get a number and increment it all in one query then? TIA TonyLOCK TABLES will not work because the lock is released when the first page is finished. You could use a file that will you will use as a lock, but this could lock your table for minutes and eventualy, if the user desides not to take any action, forever. I would suggest to use a temporary table to hold taken numbers.