Jump to content

Archived

This topic is now archived and is closed to further replies.

PieFreak

Simultaneous entry question

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

I think the command is mysql_insert_id.

 

Anyway, thanks a lot! Works great now.

 

:)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.