geko21 Posted May 2, 2011 Share Posted May 2, 2011 Hi guys, im making a basic social networking site for a college project and I need to know how to make a system that will let logged in users add each other as friends but I carnt really find anything on google about how to start. Can anyone here help me or know a tutorial I can follow that will let me create something like this? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/235355-add-friends-system/ Share on other sites More sharing options...
Psycho Posted May 2, 2011 Share Posted May 2, 2011 Well, it is assumed that each user will have a unique ID since they must log in. I would also assume you have the ability for users to view other user's profiles. So, on a user's profile page include a button (i.e. form) or link which directs the browser to an "add friend" page. In the form or link pass the user ID of the user whose profile was being viewed. Then, on the processing page, use that value to save a record to identify the "friend" link. This all assumes you understand how to build a database and make the php pages work with the database. Quote Link to comment https://forums.phpfreaks.com/topic/235355-add-friends-system/#findComment-1209491 Share on other sites More sharing options...
spiderwell Posted May 2, 2011 Share Posted May 2, 2011 google had plenty for me: http://www.google.co.uk/search?hl=en&q=friends+list+database+php&meta= as above really, have a table called friends, and note I haven't given this much thought, with a userid | friendid | status | columns. Only problem i would see is if obama added osama, obama would be the userid and osama would be friendid, whereas if it was osama adding first it would be reverse. This might cause other issues when checking if someone is already a friend on not, depending on who added who first. add me as a friend once you have done it Quote Link to comment https://forums.phpfreaks.com/topic/235355-add-friends-system/#findComment-1209493 Share on other sites More sharing options...
doddsey_65 Posted May 2, 2011 Share Posted May 2, 2011 google had plenty for me: http://www.google.co.uk/search?hl=en&q=friends+list+database+php&meta= Only problem i would see is if obama added osama, obama would be the userid and osama would be friendid, whereas if it was osama adding first it would be reverse. This might cause other issues when checking if someone is already a friend on not, depending on who added who first. i came across this problem with my site so i made a table for friend requests and a table for friends. once the request is confirmed delete it from the requests table and add their details to the friends table. more queries and it can probably be done better but it saved me confusion and complexity. Quote Link to comment https://forums.phpfreaks.com/topic/235355-add-friends-system/#findComment-1209495 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.