Jump to content


Photo

Need advice on making a table


  • Please log in to reply
3 replies to this topic

#1 dptr1988

dptr1988
  • Members
  • PipPipPip
  • Advanced Member
  • 372 posts

Posted 14 June 2006 - 12:09 AM

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
Need more help with your project? One of the thousands of programmers, web designers or artists at <a href="http://www.rentacode...d_6764522">Rent A Coder</a> would be happy to help.

Disclaimer: Free advice is usually worth what you paid for it. ( or at least when it's coming from me! )

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 14 June 2006 - 06:34 AM

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.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 dptr1988

dptr1988
  • Members
  • PipPipPip
  • Advanced Member
  • 372 posts

Posted 14 June 2006 - 03:34 PM

Thank you, fenway, for helping me!! That third table is what I couldn't figure out.

dptr1988
Need more help with your project? One of the thousands of programmers, web designers or artists at <a href="http://www.rentacode...d_6764522">Rent A Coder</a> would be happy to help.

Disclaimer: Free advice is usually worth what you paid for it. ( or at least when it's coming from me! )

#4 kharbat

kharbat
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 14 June 2006 - 05:00 PM

the third table could be this way

1- User ID , File ID (composite primary key)
2- Permission (non key attribute)






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users