I am trying to create a PHP Chatbox, I implemented my SQL database like this :
ID ID_sender ID_parent content
1 1 0 "Hello Mark"
2 2 1 "How are you Steve ?"
3 3 0 "Hi John, are you still coming tonight ?"
4 4 3 "Yes Elena, I will be there"
5 1 2 "I am good, what about you ?"
I would like to know if there was a way to implement a request that would select messages from a conversation and all the child messages, with one session variable in input. For example, if my session variable is 1, I would like to get the following conversation with my request
Steve : "Hello Mark"
Mark : "How are you Steve?"
Steve : "I am good, how are you ?"
I tried some requests with count() method but I was not able to get a good result. Thanks for your help.