Marek Kilimajer wrote:
> Tony Crockford wrote:
>> Hi
>> 
>> bit confused!
>> 
>> here's what I want to do:
>> 
>> 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?
>> 
>> Sorry for what is probably a really basic question - I did look at
>> the MySQL manual, but I'm not sure how exactly to issue an SQL query
>> LOCK TABLES using PHP. 
>> 
> 
> LOCK 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.

I may be wrong here, but doesn't PHP let MySQL retain the locks when you've
connected with the mysql_pconnect(); function? (persistent connect, I would
expect locks to get released on a disconnect, which usually happens on a
page refresh (new mysql_connect() call).

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to