Jump to content

Messaging System


HDFilmMaker2112

Recommended Posts

Looking for the best way to set-up the db of a messaging system. Here's what I have so far (basically pulled from another forum), don't know if Table1 is even really necessary:

 

Table1:

id

user_message_id

recepient_id

recepient_read

 

Table2:

user_message_id

sender_id

sender_read

subject

message

created_at

updated_at

 

 

 

Basically it needs to function where, someone submits a message to the admin or moderator, the admin/moderators can review and reply, and then the user can submit another reply, and keeps going indefinitely. I want each reply to show up almost like a forum thread.

 

How would I chain the reply messages to the original messages?

Link to comment
https://forums.phpfreaks.com/topic/251153-messaging-system/
Share on other sites

But say I have the following:

 

 

Situation 1:

User 2 submits a message -> admin 1 sees it and replies to user 2 -> user 2 replies to the message from admin 1 -> moderator 3 sees the message from user 2 and replies.

 

 

Situation 2:

user 4 submits a message -> moderator 5 sees it and replies to user 4 -> user 4 replies to the message from moderator 5 -> admin 1 sees reply from user 4 and moderator 5, and replies to user 4 about the topic and messages moderator 5 to let them know something they told user 4 was incorrect.

 

 

 

How would all of that be chained together with a simple SELECT statement?

 

I would need to select say message id numbers in situation 1:

 

123234

123453

123454

123544

 

and then loop them, to display them.

 

And then in situation 2 message id numbers:

 

342342

342346

342356

342643

342678

Link to comment
https://forums.phpfreaks.com/topic/251153-messaging-system/#findComment-1288204
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.