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

  • Home
  • SEARCH
  • 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 6385705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:56:00+00:00 2026-05-25T02:56:00+00:00

I am developing a website using PHP and MySQL where users have options such

  • 0

I am developing a website using PHP and MySQL where users have options such as:

  • receive notifications via email
  • hide/display Facebook/Twitter links

It will also allow users to control privacy of their profile from information viewable to friends/non-friends and what friends are able to view certain photos/albums.

I was wondering how I would design this table to be robust and what things should I put into consideration. How does Facebook manage each users privacy settings and options just out of curiosity?

My solution so far is along the lines of this:

id – Primary Key

member_id – Primary Key and Foreign Key (Member tables ‘id’)

facebook_viewable – int(1) – 0 for No and 1 for Yes

email_notifications – int(1) – 0 for No and 1 for Yes

  • 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-05-25T02:56:00+00:00Added an answer on May 25, 2026 at 2:56 am

    First off, you probably don’t need to have both id and member_id if they are both going to be primary. Really you need member_id so you can just drop the other id.

    To be robust, what you want is to drive settings into rows rather than columns. It is much easier from the database perspective to append rows than to alter the table to add columns.

    What you need is a table that contains a list of your privacy rule types and then an intersection table between your member table and your privacy rule type table. The schema would be something like this:

    MEMBER
      id int not null PRIMARY KEY
    , name nvarchar(50)...
    , (and so forth)
    
    PRIVACY_RULE
      id int not null PRIMARY KEY
    , rule_description  nvarchar(50)
    
    MEMBER_PRIVACY
      member_id int not null
    , privacy_rule_id int not null
    , rule_value tinyint
    , PRIMARY KEY (member_id, privacy_rule_id)
    

    This way, the privacy rule ID becomes a constant in your application code that is used to enforce the actual rule programmatically and the values can be added easily to the intersection table. When you invent a new privacy rule, all you need to do is insert one record into PRIVACY_RULE and then do your application code changes. No database schema changes required.

    Note that this same basic structure can be elaborated on to make it much more flexible. For example you could have many different types of values beyond a binary flag and you could control the interpretation of these values with an additional “rule type” attribute on the PRIVACY_RULE table. I don’t want to go too far off topic with this so let me know if you want further detail of this aspect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently developing a website which stores bookmarks in a MySQL database using PHP
I'm developing a website using PHP, MySQL and HTML. In the database, one of
i am developing a online test website using PHP. i have set time limit
I am currently developing a PUBLIC and OPEN SOURCE software using PHP/MySQL. I have
I am currently in the mist of developing a website using PHP and MYSQL.
I am developing a website using CodeIgniter and PHP. Some of my friends suggest
I have been developing a login library for a website using CodeIgniter. The authentication
I am developing a website using PHP and Apache. I wanna turn my URLs
I'm developing a website using php, i want to know how can i protect
I'm developing a website using PHP and these strange chars  appears in my

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.