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 6073245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:15:00+00:00 2026-05-23T10:15:00+00:00

if i have this table: users —– id_users (pk) age name gender salary it

  • 0

if i have this table:

users
-----
id_users (pk)
age
name
gender
salary

it is needed for each of these values an option to set visible or not in user profile.
What do you think that is the best way to do that?

For example hide the field salary to the person x, but allows to the person y.
basically some persons can watch some attributes.

thanks

  • 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-23T10:15:00+00:00Added an answer on May 23, 2026 at 10:15 am

    If the default privacy will be show to all, then you can create a table to hold all the hide settings of a certain user to a certain user.

    This is the table I would suggest, with a compound PK of the three columns:

    hide_details
    ------------
    visitor_id
    user_id
    what
    

    Some sample data would be:

    visitor_id      |       user_id     |       what
        1                       2               age
        1                       2               name
        3                       4               salary
    

    This table schema will not have to be updated in the future if you add another column to your users’ table. Suggestion, if you want to make this amazingly fast you can map the column names to integers, and use that in your application logic to compare against. E.g. name = 1, age = 2, etc… So, when you do the comparison to hide the name or not, you just check if there is a record with that integer in the hide array.

    You can use it like the following: before you display a profile, you fetch all the hide records of that visitor to that profile, and put them in an array, and then display anything, which hasn’t been hidden.

    E.g.

    $hide = array('name', 'age', 'salary');
    

    Then, you can check like:

    echo (in_array($hide)) ? '' : '<div>Name:'.$name.'</div>';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DataGridView binded to this table: [Users] ID Name -- ---- 11
I have a table defined like this: create table users ( id int(10), age
i have this design table: users ------------- PK id_users users table: single_users -------------------- PK
I have this users table with: id : int (255) name: char (100) last_comment_target:
I have this mySQL syntax which updates the table users and column skills_mod_time every
I have a database table called users This table has two columns (that are
I have this table structure: CREATE TABLE users ( uid bigint NOT NULL, first_name
Say I have a table like this: create table users ( user_id int not
I have this problem. Given a users table that consists of users' username in
I have this statement which calls insert data to table users when table users

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.