PieFreak Posted March 3, 2003 Share Posted March 3, 2003 I\'ve got a script that allows a user to create a group which can be identified by the variable group_id. After the creation process is complete, my script checks the database for the latest group_id to be entered and uses that id to enter the group lobby automatically. The problem comes about if a person creates a group and is just about to be forwarded to his/her lobby when another user also creates a group and the script takes the second person\'s group_id as the latest entry. Any ideas on how to get around this? Quote Link to comment https://forums.phpfreaks.com/topic/193-simultaneous-entry-question/ Share on other sites More sharing options...
pallevillesen Posted March 3, 2003 Share Posted March 3, 2003 If you\'re using a session, then the last_entered_id function of mysql and php is session specific. It only keeps track of the auto_increment values. If you\'re NOT using that, then you\'ll have to keep that variable in your php script and save it until finished with the creation... It seems like you\'re using an auto_increment for group_id though... So... you should probably just use sessions. P. Quote Link to comment https://forums.phpfreaks.com/topic/193-simultaneous-entry-question/#findComment-571 Share on other sites More sharing options...
PieFreak Posted March 3, 2003 Author Share Posted March 3, 2003 I think the command is mysql_insert_id. Anyway, thanks a lot! Works great now. Quote Link to comment https://forums.phpfreaks.com/topic/193-simultaneous-entry-question/#findComment-573 Share on other sites More sharing options...
pallevillesen Posted March 4, 2003 Share Posted March 4, 2003 You are absolutely right! The other one is sql, my mistake... glad it works... P. Quote Link to comment https://forums.phpfreaks.com/topic/193-simultaneous-entry-question/#findComment-585 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.