On Tue, 25 Nov 2003 07:47:58 -0600, Jay Blanchard <[EMAIL PROTECTED]> wrote:

[snip]
[snip]
is there a way I can get a number and increment it all in one query
then?
[/snip]

UPDATE tblFoo SET value = (value+1) WHERE conditions


Hmm.. my bad - I get that bit, but can I do:


SELECT value WHERE conditions UPDATE tblfoo SET value= (value+1)
[/snip]

Essentially that is what the UPDATE statement is doing, you are
selecting values to be updated with the where condition. Your way is two
queries The SELECT (which locks, then releases) and the UPDATE (which
locks, the releases). In the split second between the select and update
the row is not locked, an undesirable conditions.


Ah.


Sorry, I'm being particularly dense today.

What I want to do is get the value from mysql for use in the PHP page, but update the value once i've got it.

How do I give the rest of my PHP script the original value to use with an SQL update?

e.g.

get counter value & increment counter value (so my number can't be used again)
use original counter value as *part* of unique reference number to save user input details in a different table.


TIA

Tony

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



Reply via email to