using PHP 5, mysqli extension, and mysql 4.1.3: according to the mysql documentation, last_insert_id returns the last autoincremented value from an insert OR update. ...but, how would you get an update query to autoincrement?
When I set an autoincrement field to a number I created, insert_id() returns 0.
Q: I need to get an updated record's primary key without having to submit a subsequent SELECT statement. Allowing two consecutive statements (UPDATE, then SELECT) might allow another UPDATE to occur (in a multiuser environment) before the Select statement could be called, returning the second record's primary key value instead. ...and 'no', I don't know the PK value I just updated, because my statement was 'UPDATE PK SET PK = PK+1 WHERE 1 LIMIT 1'
Reason: I have a single field , single value table I use to maintain a counter.