开发者

PHP/MySQL - specific pages for specific users

In my current project in PHP 开发者_JAVA百科and MySQL, I have a database of user and a database of projects. I want to be able to assign projects to users so that they only have access to those that they have joined (by whatever means). Is there a more efficient way of doing this other than having some sort of array within a field of a user?


Create a table with two foreign keys: one pointing to the primary key of the user table and the other pointing to the primary key of the project table. This is the standard way of implementing so called m:n-relations (a user can have multiple projects and a project consists of multiple users) in relational databases. Read up on database normalization for reasons why.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜