PHP/MySQL 带组的用户系统
我在“用户”表中设置了用户系统,在“组”表中设置了组。本质上,我希望用户能够加入他们想要的任何和所有群组,就像在 Facebook 上一样。
如何在 mysql/php 数据库系统中构建这一结构?只要快速总结一下就会很有帮助!
我环顾四周,但只能找到有关创建“组”的信息,其中用户只有 1、2 或 3 级权限。
I have a user system set up in a 'users' table, and I have groups set up in a 'groups' table. Essentially, I want users to be able to join any and all the groups that they want, in the same was as one would on facebook.
How would one go about structuring this in a mysql/php database system? Just a quick summary would be helpful!
I've looked around, but I can only find info on creating 'groups' where the users just have a sort of 1, 2 or 3 permission rank.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我会有一个类似的数据库:
所以 JoinedGroup 拥有一个 UserId 和一个 GroupId。当用户想要加入组时,只需向 JoinedGroup 表添加一行即可。
从某个组中选择用户只需要一个简单的内部联接。
I would have a databse something like:
So the JoinedGroup holds a UserId and a GroupId. When a user wants to join a group just add a row to the JoinedGroup table.
Selecting users from a certain group would just require a simple inner join.