Author Topic: MySQL JOIN tables need help  (Read 435 times)

0 Members and 1 Guest are viewing this topic.

Offline valtidoTopic starter

  • Enthusiast
  • Posts: 156
    • View Profile
    • iAlbo Hosting
MySQL JOIN tables need help
« on: June 19, 2007, 12:34:30 AM »
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....

Offline DanDaBeginner

  • Enthusiast
  • Posts: 211
    • View Profile
Re: MySQL JOIN tables need help
« Reply #1 on: June 19, 2007, 01:25:08 AM »
 :) 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...