How PHP sends a message to multiple users.

Source: Internet
Author: User
Tags mysql update
This post was last edited by Phpcainiao on 2013-10-14 10:09:27

For example, I now have a user watch with Id,users,pwd,yonghuzu in it.
There are three records in it, and the users have
Admin Admins group (Yonghuzu)
Zhang San VIP advanced User (Yonghuzu)
John Doe VIP Advanced User (Yonghuzu)


Another page, I want to achieve the result of such a child:
For example I have to send a word to one or more users, user groups, how to send. How to design a table to store data reasonably and facilitate reading.
I was going to design ID (AutoNumber), Cont (Sent content), username (single user sent)
It's convenient to send it to a single user,
But how this is to be sent to multiple users, and user groups, you do not know username or the back of how to read more reasonable.

Also consider that after the user logs on, it is convenient to read the message list page about this user.


Reply to discussion (solution)

You can consider the next three sheets.
1. User Grouping
2. User tables
3. Message list sent to the user

Where the user table needs to have a field and a user group association, the message table has a word Gencun User ID number and User Table association.

MySQL Update


1 Hello 1,2,4,5
2 He's good 3,4,5.
3 We're all good.
4 haha 2,3,4
The following array is the user.
The first one is the AutoNumber ID, the second cont content, and the third is the user
I'm going out now. All messages with User ID 4: How do we get out here?

If your watch is like you said, there's no way to get the data out of the SQL statement directly.
Can consider the next day to save a record of information, such as: 4 haha 4
This makes it easier to query.

  • Related Article

    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.