in reply to DBI: last insert id

As a completely seperate way to do this, if it's ok that any updates to a row make it considered the 'last inserted', you can add a new column to your table of type TIMESTAMP, and mysql will keep it up to date as the most recent insert or update to that row. You could then select on that, and it'd be ok if it's from a separate session. Hope this is at least interesting, and maybe helpful :)