LanceT Posted January 29, 2007 Share Posted January 29, 2007 Anyone know how I would go about constructing a "friends" function sort of like a buddylist thing. An example would be on Myspace where someone will add people as their friends, then the person added needs to confirm the friend add and then both are friends.I'm not quite sure how I would even go about constructing this kind of function, any hints? Thanks. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted January 29, 2007 Share Posted January 29, 2007 Create a table like this:TABLE friendsfriendID (the person they are adding)requesterID (the person who added them)and this...TABLE friend_requestsfriendIDrequesterIDWhen they want to make a request to be someones friend add the info to the friends request table, then you can display somewhere on your site where they can accept/decline them. If they accept add the info to the 'friends' table.This is a pretty simple concept...so I'm not sure what else I could say. If you don't understand something, let me know. Quote Link to comment Share on other sites More sharing options...
LanceT Posted January 29, 2007 Author Share Posted January 29, 2007 [quote author=pocobueno1388 link=topic=124474.msg515785#msg515785 date=1170031566]TABLE friendsfriendID (the person they are adding)requesterID (the person who added them)[/quote]friendID and requesterID are the same thing. The person they are adding and the person who added them? That doesn't make sense.For example, person 1 makes a request to be friend to person 2, the person they are adding is person 2 and the person who added them ("them" referring to person 1) is still person 2.Please clarify it a little bit.I kind of understand what you are saying, but also, I need person 1 and person 2 to both appear in eachother's profiles under friends. In this case, wouldn't it only go onto one person's profile? Quote Link to comment Share on other sites More sharing options...
Tandem Posted January 29, 2007 Share Posted January 29, 2007 Have a table full of friend requests.Structure it with a field for the person requesting to be friends with, and for the person being requested of, and the status of the request i.e pending, accepted etc. (delete rejected requests)You can then display the accepted requests as you please. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted January 29, 2007 Share Posted January 29, 2007 Tandem basically cleared what I said up, except better. His idea only uses one table...don't know why I didn't think of that, lol. Quote Link to comment Share on other sites More sharing options...
LanceT Posted January 29, 2007 Author Share Posted January 29, 2007 thanks a lot, topic solved. Quote Link to comment Share on other sites More sharing options...
ki Posted January 29, 2007 Share Posted January 29, 2007 I think i already gave an example of this. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.