Jump to content


Photo

Simultaneous entry question


  • Please log in to reply
3 replies to this topic

#1 PieFreak

PieFreak
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 03 March 2003 - 02:10 AM

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?

#2 pallevillesen

pallevillesen
  • Members
  • PipPipPip
  • Advanced Member
  • 135 posts
  • LocationDenmark

Posted 03 March 2003 - 08:02 AM

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.
Palle Villesen, www.birc.dk [br]Bioinformatics Research Center

#3 PieFreak

PieFreak
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 03 March 2003 - 11:36 AM

I think the command is mysql_insert_id.

Anyway, thanks a lot! Works great now.

:)

#4 pallevillesen

pallevillesen
  • Members
  • PipPipPip
  • Advanced Member
  • 135 posts
  • LocationDenmark

Posted 04 March 2003 - 08:53 AM

You are absolutely right!

The other one is sql, my mistake... glad it works...

P.
Palle Villesen, www.birc.dk [br]Bioinformatics Research Center




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users