Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7916951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:59:10+00:00 2026-06-03T14:59:10+00:00

I have a php/mysql application. There are users who have folders. Folders can only

  • 0

I have a php/mysql application. There are users who have folders. Folders can only be one level deep. Each folder can have unlimited number of documents. The relevant tables are as follows:

user_table:

user_id(PK), name, password, etc

folder_table:

folder_id(PK), name, user_id(FK into user_table)

document_table

document_id(PK), user_id(FK), folder_id(FK), date, name, etc

All queries to operate on folders and documents are of the form

select/update/insert <blah, blah, bhah>
where user_id = %d

Now, I’m looking to allow users to share they folders with other users. I want to do this in the least disruptive way possible. I also want to minimize run time overheads of resulting WHERE clause.

I’ve been wracking my brains and googling but haven’t found a simple enough solution. I can think of implementing it in a manner similar to unix’s (read, write, execute) along with (owner, group, others) mechanism. But it seems a bit too complicated for my humble system.

I would really appreciate if someone could give me pointers as to which approach I could possibly take. My goals are simple:

  1. The system doesn’t require a whole lot of reworking
  2. At a minimum users should be able to share folders with other users or groups (I
    will add concept of groups if needed)
  3. There should not be too much overhead in SQL statement’s WHERE
    clause as opposed to what it is now (as simple as: WHERE
    user_id = %d
    )
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:59:11+00:00Added an answer on June 3, 2026 at 2:59 pm

    Sharing folder(s) with user(s)

    You can to add a table *folder_user* with columns folder_id(FK), user_id (FK)

    The user_id in *folder_table* represents the owner of the folder. When the owner shares this folder with another user, you add folder_id and user_id (with whom folder is shared) into folder_user table.

    Later, you can add column access (enum 'READ', 'READ_WRITE') to the same table, to see if a user is allowed to edit documents in the folder or not.

    Sharing folder(s) with group(s)

    1. You need a table group
    2. Then you need to add users to groups, so add a table *user_group* : user_id(FK), group_id(FK)
    3. Then, to give access to of a folder to a group add table *folder_group*: folder_id(FK), group_id(FK) to give access for a folder to a group.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an PHP/MySQL application where the users can create their own databases, which
I have a PHP MySQL application which has a modular design. There are about
I have PHP application that contain three small applications. Each application have own users
We have a PHP/MYSQL application that collects user input, including special characters like ø,ü,ñ,
I have a LAMP (Linux/Apache/MySQL/Php) application that I should release soon. Even if I've
I have a PHP web application which uses a MySQL database for object tagging,
I'm writng a small application in PHP + MySQL and have come to the
I have a small application written in PHP and a mysql database hosted on
I have been working on on an AJAX chat application using php, mysql. It's
For eg, I have this code for my PHP calendar events application. /**MySQL code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.