Jump to content

add friends system


geko21

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/235355-add-friends-system/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/235355-add-friends-system/#findComment-1209491
Share on other sites

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  :P

Link to comment
https://forums.phpfreaks.com/topic/235355-add-friends-system/#findComment-1209493
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/235355-add-friends-system/#findComment-1209495
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.