Matthias Pigulla wrote:
> mysql_query(&con, "insert into a (val) values('test')");
> printf("last insert id is %d\n", mysql_insert_id(&con));
> mysql_query(&con, "insert into b (id,val)
> values(last_insert_id(),'test')");
> printf("last insert id is %d\n", mysql_insert_id(&con));
>
The manual is vague on this point.
"It will not even be changed if you update another `AUTO_INCREMENT'
column with a non-magic value (that is, a value that is not `NULL' and
not 0)."
Unfortunately the manual is mute on what should happen to LAST_INSERT_ID
after an INSERT into a NON-AUTO_INCREMENT field. If you want to use the
original value to update or insert into more than one table, you
probably should retain it yourself rather than rely on MySQL.
jim...