in reply to SQL Troubles

While somewhat OT, LAST_INSERT_ID() is probably what you need.

-Blake