I want to display some data to specific users. I've already done something similar but the difference is that the role number was static. For example I added a column and gave '1' to specific users, so I wrote if($role == 1) { do something }. That was fine because it's a static number. With this way I'm showing secret information only to users with role 1.
Now I've added a new feature; the admin can upload information for specific users that belong to a group. Info will be different for groups. The data is stored and retrieved just fine. That's not my problem. For example I want to display document A to users 'a1','a2','a3' who are in group A (it's random names, i just want to make it easier for you), document B to users 'a4','a7','a35','a40' (who are in group B) and so on.
I know how to store/retrieve document 'A' and link it with users 'a1','a2','a3' and their group... but I'm not sure how I can show each document to a group. Document A can only be linked with one group (same for B,C,D.. etc).
TABLES
DOCUMENTS
Number - Title - File
1 - Document A - A.doc
2 - Document B - B.doc
DOC_USERS
Doc N - User N
1 - 10
1 - 15
2 - 7
DOC_GROUPS
Doc N - Group N
1 - 1
2 - 2
Instead of saying if($role == 1) as I did before.. I will need something like if ($document == $group). I cannot put 'A', or 'B' or whatever because it's not static though.
Any help?