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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:07:37+00:00 2026-05-26T04:07:37+00:00

If someone can help me with this issue I have I’ll appreciate it SO

  • 0

If someone can help me with this issue I have I’ll appreciate it SO MUCH!

I’m making a website where I want registered users to be able to add each other as friends.

The person must “invite” another registered user (on the database). The other person will receive a notification of some sort. If the person ignores the notification, nothing happens and when he/she approves, they are friends.

Now I have a idea with the table I’m going to use:

+----------------------------------------+
|               Requests                 |
+----------------------------+-----------+
| id | user_from |  user_to  |   status  |  
+----+-----------+-----------+-----------+
|    |           |           |           |
|    |           |           |           |
|    |           |           |           |
|    |           |           |           |
+----------------------------+-----------+

As I said this is only an idea I want to use but I don’t know what the code will be in the php when I have a link to add a person as a friend.

I think the admin to approve of the request sent and when the user approves or not. I don’t know how that table will look.

And I thought about using INNER JOIN to “join” the two users as friends. BUT again, not completely sure how to go about that. Will this come in my php? Lets say friends.php?

SELECT name, email FROM users

INNER JOIN friends ON users.id = friends.user.id WHERE users.id = 1

As I said, I have a good idea of what to do but when it comes to coding it, I’m not completely sure how to do that…

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-26T04:07:38+00:00Added an answer on May 26, 2026 at 4:07 am

    You should have a relationships table that simply associates user.id’s.

    +-----------------------------------------+
    |               relationships             |
    +-----------------------------------------+
    | id | user_id1  |  user_id2   |  status  |
    +----+-----------+-------------+----------+
    |    |           |             |          |
    |    |           |             |          |
    |    |           |             |          |
    |    |           |             |          |
    +------------------------------+----------+
    

    Where user_id1 and user_id2 are both user.id. Note: I’d probably make status be an enum, with something like ‘pending, declined, friend, enemy’. I initially thought of using a bool, but what if there is some other desired status later on? Like maybe you keep track of broken friendships, or some other kind of relation.

    Then you simply do a multiple where clause to determine friends:
    WHERE (user_id=:id OR friend_id=:id) AND status='friend'

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

Sidebar

Related Questions

I was wondering if someone can help me out with this issue. I have
I have an issue which I hope someone can help me with. I'm able
I hope someone can help... This issue has been discussed here and I have
I really hope someone can help me with this. Basically i have an issue
I hope someone can help with this issue. I have a popup iframe using
Okay people, I'm sure someone has had this issue and can help me out.
I'm really hoping that someone can help. I have tomorrow to get this right
Hopefully someone can help with this RelativeLayout issue I'm having. If I remove the
Hope someone can help with a bit of a frustrating issue. I have a
This issue is something which has me stumped, so hopefully someone can help. I

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.