On Tue, Feb 29, 2000 at 05:56:32PM -0800, da...@directint.net wrote:
I have a counter in the DB that I need to read and update atomically.
Currently I am basically doing this:
SELECT id FROM maxurlid;
UPDATE id SET id=id+1 where id=$found_id;
(then I use $found_id later)
Dave, there is a trick you can do with LAST_INSERT_ID() that will do
what you want. Look in the manual at the docs for LAST_INSERT_ID, and
look for where it says, "This can be used to simulate sequences:". It
describes what you want to do.
Tim