Answer the question
In order to leave comments, you need to log in
How to create a chat dialog?
I have 3 tables in the database:
1) Users
2) Messages
3) Conversations
---
Conversations structure: id user_id
Messages structure: id message user_id conversation_id
There is a simple front where I enter the user's username into the input, it finds it, how to create it further dialog, so that when logging in from your account and from the user's account it would be visible?
Or how to alter the structure of the database, what would be clearer?
Now I don’t understand whose user_id I should write in Conversation, the one who clicked or the one who was clicked, if I write down the one who clicked, I can get this dialog from the database, because I know the id and the dialog will be immediately displayed in my account, but if I will go from the one who was clicked on, how will I get this dialogue out of the database?
It is not clear to me how to organize the creation of a dialogue between people, provided that there can be several dialogues.
Answer the question
In order to leave comments, you need to log in
Obviously, in Conversations you need to write the id of all participants in the dialogue
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question