Jump to content

MySQL JOIN tables need help


valtido

Recommended Posts

Hi all im in a sorta dilema more or less.

Basically i have tried a few different things on how to make a relationship between users and their friends ...

 

Basically i got tables like sooo..

 

Users  Table

UserID      -    UsersName          -        FriendsID

1                      John                            ?

2                      Ben                              ?

3                      Tom                            ?

 

Friends table

Friends ID                UserID              Status

1                              ?                  Accepted

2                              ?                  Rejected

3                              ?                  Pending

 

 

so whot im trying to do is to find a way to allow this people to be friends whith one another and when they other user accepts the friendship request they are friends....

 

for example john sends a request to be friends with ben and ben accepts they are now friends...

 

if you dont understand please ask  thank you....

 

Link to comment
Share on other sites

:) you may put two insert there - for example if id=1 add id=20 then there will be two rows for them one for id=1 saying that his friend is id=20 and vice versa... then if id=1 deleted id=20 as his friend then delete row id=1 and change the status of id=20..something like that may help you...
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.