saintseiya Posted September 28, 2007 Share Posted September 28, 2007 I am inserting a new user into the users table. And a new user options into user options table. I need to relate them both by their ids... and i am getting their upcoming id by grabbing last entry in the table and assuming the new id will become (last id) +1. I do this for both then i insert them each, something like... useroptions_owner='$last_user_id+1' other query: users_options_id='$last_users_options_id+1' I am worried that if the site becomes big this might be a problem if 2 users hit the register button instantaneously. Is this a possible problem by using this method of adding a new user? Should i insert the user, then grab his id by e-mail and then use that id to insert his options in order to remove the possibility of it messing up? Or should I assume mysql is fast enough and this method will never mess up. PS.- dont ask why the options are on a different table or anything like that Help appreciated! Link to comment https://forums.phpfreaks.com/topic/71048-is-it-possible-that-mysql-messes-up-if-i-insert-2-things-the-following-way/ Share on other sites More sharing options...
fenway Posted September 28, 2007 Share Posted September 28, 2007 last_insert_id(columnname) is thread-safe. Link to comment https://forums.phpfreaks.com/topic/71048-is-it-possible-that-mysql-messes-up-if-i-insert-2-things-the-following-way/#findComment-357235 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.