Tables locked a bit too tight
| From: | Michael Hendsbee | Date: | Fri, 16 Aug 2002 21:44:31 +0000 |
| Subject: | Tables locked a bit too tight | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-21185@lists.php.net to get a copy of this message | ||
I want to lock a table so that other pages can not access the table in
between the data pull and date update.
But it would seem it locks the *same* page from updating (but not from
reading thankfully).
PHP:
----------------------------------------------------------------------------
----
mysql_query('LOCK TABLES ConfigVars READ');
$result = mysql_result( mysql_query('SELECT Counter, AffilateIDcode FROM
ConfigVars'), 0);
...
mysql_query('UPDATE ConfigVars SET Counter = (Counter + '."$increment)");
mysql_query('UNLOCK TABLES');
----------------------------------------------------------------------------
----
Am I right? If I am, what can be done to fix this problem?