Private Message function design for help!

Source: Internet
Author: User
Create a private message function (php + mysql) similar to the OSC Website: 1. list all the private messages I sent and sent to me on the list page. Of course, only the last one sent or received is displayed for the same person. how can I design a data table that lists all the dialogs between two people on the view page? How to read the list page? Create a private message function (php + mysql) similar to the OSC Website ):

1. list all the private messages sent and sent to me on the list page. Of course, only the last one sent or received is displayed for the same person.

2. view the page to list all conversations between two people

How to design a data table?

How to read the list page?

Reply content:

Create a private message function (php + mysql) similar to the OSC Website ):

1. list all the private messages sent and sent to me on the list page. Of course, only the last one sent or received is displayed for the same person.

2. view the page to list all conversations between two people

How to design a data table?

How to read the list page?

Let me make it simple.

If the capacity is small, one table is enough.

Fields include primary key id parent id sender id receiver id content Sending time

All private messages are stored in this format.

The parent id of the first private message sent for the first time is 0.

If you reply or continue sending the message, the parent id is the primary key id of the first private message.

View the private message dialog details, and you can use the id of the first private message to go to the parent id field for query and sort it by time.

If the private message list is used, the user ID sender or receiver can use the group and having groups to filter out the last reply in the dialog.

In short, there are a lot of methods to achieve data table design. The logic layer is simple. Some data tables are simple. The logic layer will be complicated and weigh the advantages and disadvantages.

The parent id here seems useless, right?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.