Jump to content

Archived

This topic is now archived and is closed to further replies.

dptr1988

Need advice on making a table

Recommended Posts

I have a list of users and a list of files and I want to use MySQL to decide which user can access which file. I was thinking of create one table for the users and another one for the files. Then each entry in the file table would say which user could access it. But how can I make it so I can have multiple users in each file table entry? Do you have any suggestions on the basic structure of the tables?
Thanks

Share this post


Link to post
Share on other sites
You're right to keep a separate table of files and users -- you just need a third table where you assign permissions and "link" files to users.

Share this post


Link to post
Share on other sites
Thank you, fenway, for helping me!! That third table is what I couldn't figure out.

dptr1988

Share this post


Link to post
Share on other sites
the third table could be this way

1- [u]User ID , File ID[/u] (composite primary key)
2- Permission (non key attribute)

Share this post


Link to post
Share on other sites

×

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.