If I understand you correctly you already have the the last inserted ID
in another column in the same table so you just need to copy it. You
need to make sure you only update the row you just added though. This
should do it -
UPDATE <table> SET <other column> = <primary ID column>
WHERE <primary ID column> = LAST_INSERT_ID();
You need to do that immediately after the insert on the same connection
for the value of the last insert ID to be correct.
From: Jerry Schwartz [mailto:jerry@stripped]
Sent: Saturday, 22 January 2011 6:27 AM
Subject: Retrieving last_insert_id
I have an auto_increment field in my table, but I need to set another
field to the same value. (Please don't ask why.)
It seems I would need to insert the record, and then update it; but I
haven't figured out how to get the value of last_insert_id().
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032
860.674.8796 / FAX: 860.674.8341
E-mail: <mailto:jerry@stripped> jerry@stripped
Web site: <http://www.the-infoshop.com/> www.the-infoshop.com