Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.