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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:05:15+00:00 2026-05-26T11:05:15+00:00

I am wondering how best to layout my database for my friends system? I

  • 0

I am wondering how best to layout my database for my friends system? I was going to do it like this,

 id (int) | friendID (int) | accepted (enum)

Which is how I think it should be done, just one question:

  1. Upon a user confirming a request should I change the current row enum to yes and then insert another row for the user that confirmed it? ie;

    1 | 4 | yes
    4 | 1 | yes
    

Or is there a way I can pull both relationships from the one row without inserting another?

ie;

1 | 4 | 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-26T11:05:15+00:00Added an answer on May 26, 2026 at 11:05 am

    In this case I think it is better to insert twice for each friend, since space is cheap, and you’ll probably be adding friends less often than reading them. If you want to save space however, you can change the way you select the friends from:

    select friendId from friends where id = $userId
    

    to

    select friendId, id from friends where id=$userId or friendId=$userId
    

    then on the php side, you would check if friendId or id is the currently logged in user etc.

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

Sidebar

Related Questions

Wondering what the best / good way of doing this would be in jQuery.
I am wondering the best way to store html templates in a database where
I am wondering what is the best layout for a customer service document in
Wondering the best way to go about querying the database with optional parameters. For
I'm wondering about the best way to achieve a relatively usual layout with mig
I have a listview which displays emails with the following layout: email@address.com category //This
So, I was wondering which is the best way include a single view (
Just wondering the best way to replace in place matches on a string. value.replace(bob,
I'm wondering about best practice here. Is it good practice for a factory method
I was wondering the best way to upload file to a web server in

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.