Hello Not sure if you thought of it or if it even applies to you but when you use PEAR::DB::getOnce("SELECT LAST_INSERT_ID()"); to retrieve the id do consider concurrent access to the database when using it for inserting stuff. Been there and its a hassle to resolve this little huge bug ; ) Consider the following situation:
Two users ( A and B) make simultaniouse access to your server. A queries the Database for an id B queries the Database for an id A writes stuff into the database using the retrieved id. Now A and B both have the same id and if B wants to insert something into the db using id it will fail if id has to be unique (like in a primary key, foreign key, etc...) B has to querie the database for the correct id again. So make sure you read lock the table for the query and the insert or make sure you never use the retrieved id for inserting stuff. Regards Stefan Langer