On Sun, 2007-02-04 at 11:37 +0200, Octavian Rasnita wrote: > Ok, I think I understand. > I use last_insert_id() right after making the insert and store it into a > variable and usually I just need to insert some records in another table > right after this, but then I won't need it anymore, so I don't need to store > it. > > I assume that if I use the same $dbh reference for accessing the database, > it will use the same connection and it won't return a bad "last inserted > id".
Correct. last_insert_id is $dbh specific. So while you may have other processes doing the same insert on the same tables at the same time, they are using different $dbh's, and will not interfere with each other. Clint