Page is a not externally linkable
- Code, Content, and Presentation
-- Databases
---- Which row did I just insert?


rocknbil - 4:57 pm on Jun 14, 2011 (gmt 0)


Yeah but make sure you get via last insert id immediately after doing the insert . . . I always use a new select with the unique data I just inserted to make sure it's the relevant record.

Select id from table where email='inserted@email.com' and user_id=12345;

It's always a **very good idea** to use a second field for user_id or other unique id rather than the auto increment field.


Thread source:: http://www.webmasterworld.com/databases_sql_mysql/4325736.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com