Didn't you have to specify the ID of the record in order to UPDATE it? 

If not, and you updated several records, and assuming that the function 
LAST_INSERT_ID worked as you had expected it to work, you would have still 
only gotten one of the ID values for one of the updated records, right? 
What would you have done to track the other, non-reported records?

If you need the IDs of the records you are updating, you may need to 
perform this in two steps surrounded by either TABLE LOCKS or within a 
TRANSACTION so that things don't change between when you query for a list 
of IDs to update and actually perform the updates.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine



Michael Ragsdale <[EMAIL PROTECTED]> wrote on 10/13/2004 11:10:12 AM:

> I've been using mysql_insert_id() with great success, but now I've got a 

> problem.  I'm using UPDATE to, well, update a record in a database and 
> according to the docs...
> 
> >mysql_insert_id() is updated after INSERT and UPDATE statements that 
> >generate an AUTO_INCREMENT value or that set a column value to 
> >LAST_INSERT_ID(expr).
> 
> If the record did not exist and UPDATE performed as INSERT, then I would 

> theoretically have no problem.  Hower, since the record that I'm 
updating 
> already exists, the AUTO_INCREMENT value also already exists and that 
value 
> is not being re-generated.  Therefore, the value that mysql_insert_id() 
is 
> returning is zero.  Is there a similar way to capture the id of the 
record 
> that is being updated?
> 
> -Mike 
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
> 

Reply via email to