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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:47:59+00:00 2026-06-10T04:47:59+00:00

I want to make an application where there will be different users and each

  • 0

I want to make an application where there will be different users and each user will have a set of friends which will be put in categories. There will be some default categories, but the user will be able to add his own. I was wondering which will be the best way to do this.

My idea is to have 3 tables – user, friends and categories.

The user table to have fields (one to many) for friends and categories (but I don’t know if the user table will need any information about the friends and the categories at all).

The friends table to have a field for categories (one to many) and a field for the user (many to one).

The category table to have fields for user (many to many?) and friends (many to many?).

I’m not sure about the relations, too. I’m using PHP with MySQL and Symfony2 and Doctrine2. Please help!


EDIT

Maybe I haven’t described exactly what I need. When you open the app, you see a login form. If you don’t have an account, you should register – the registration creates a new user. This user isn’t connected with other users (I’m still new to programming and I want something a little easier so it’s something like phonebook). Each user has a list of friends and a firend is a row in a table with fields such as name, addres, phone, email, photo, birthday and so on, but they are added by the current user. The friends are not users. Every user is in fact an account with password and username and when you log in there is just a list of friends. So each user creates categories for himself and he has nothing to do with other users and their categories. The category will have only id and name.

So the idea is that you create an account, then create some categories and add friends to them just to have an organiser when you friends are born or where they live, or which is their phone number, but you create them and add the information about them, they are to users themselves. It’s not like a social network. Just a notebook where each user can write info about his friends.

  • 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-10T04:48:01+00:00Added an answer on June 10, 2026 at 4:48 am

    First of all, you need to understand the role of intersection tables: if user A labels user B as a friend (i.e. there is a many-to-many relation from user to itself), and you create a new table to represent that relation (the friends table), any additional information about this “friendship” should be linked to that table. So, if a user categorizes his friends in some way, the category applies to friends, not to user. There’s no need for a relation between category and user for this specific purpose.

    Update: since friends are not users, the friends table will not be an intersection table (and thus have only one reference back to user, denoting the “owner”), but the rest of the answer still applies.

    I’m assuming each category will be a row in the category table. Additional information about the category might be added, but it should be limited to that. For instance, if you want to know which user created a category, you could add a foreign key to user labeled for instance “owner” or “created_by”. That might be useful if categories created by one user are not to be seen by others.

    Finally, you can relate friends with category. If User A can put user B in at most one category, then a foreign key from friends to category should suffice (i.e. a one to many relation). Otherwise, you might need another many-to-many relation, so an additional intersection table should be created (for instance friend_category).

    You could avoid this extra table by employing denormalization, having multiple rows in friends where both users are the same (and in the same order) but the category is different (see also this example). Whether this is advantageous or not is beyond the scope of this answer, but IMHO using an extra table is better for now (it might seem more complicated, but it will be easier to maintain in the long run). (Update: if friends is not an intersection table, denormalizing like this is not really an option, so stick with the friend_category table)

    In the end, your layout would look like this:

    user              friends           friend_category   category
    ----              -------           ---------------   --------
    (user fields) <-- user (owner)    <--  friend         (category fields)
                      (friend fields)      category   --> user (owner) --+
    ^                                                                    |
    |                                                                    |
    +--------------------------------------------------------------------+
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make an application in C or C++ which have to monitor
If I have a PHP application which allows users to make changes to documents,
Is there a way to make an application uninstall itself? For example: I want
I want make interactive application where user launches it and can do various task
I want to make an application that would display a message when a user
I want to make an console application of c which can run other applications
I have a docx file in my SVN repository. Now I want different users
G'Day programmers...I am planning to make an application which will be using peer to
I want to make my application similar to mail.app in vertical orientation. It should
I want to make an Application that uses RxTx version 2.2pre2 to work with

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.