Jump to content

Mysql help with forming insert/select


DarkReaper

Recommended Posts

Okay here is what i have in theory:
A list of users.
1. If a user clicks on another users name mysql inserts a row in the db saying that the users requests lets say "chat".
2. set a session var to the row id for the 1-st user.
3. The second users sees that its attention is requested and clicks on the above users name, mysql update-s the row acccoudingly.
4. set a session var to the row id for the 2-nd user
5. Both users do their "chat".

So far so good. But if both users click at the same time 2 rows get inserted (sometimes), usually the 2 sessions vars should be the same but they are not since mysql inserted 2 rows and the 2 vars are different, and the whole module gets to hell cous one user thinks it is "chatting" with someone as is the other, but in fact noone cant see the other couse the 2 rows in the db kinda kill functionallity.

In short 2 rows exist but there should be only 1.

Dont know if you understood me ...

*notice: i say "chat" because i cant think of a word to fully classify it.
Link to comment
https://forums.phpfreaks.com/topic/16821-mysql-help-with-forming-insertselect/
Share on other sites

Archived

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

×
×
  • Create New...

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.