Jump to content

Advice on Friends list


ambo

Recommended Posts

If you're using MySQL as the database then it can be relatively simple. Basically you just need a new table with a primary key id which auto_increments, another int called user_id and another int called friend_id. Then when someone clicks a person to add them to their friends list, just add the users id in and the person who they want their friend to be in. When getting all friends for a user you just need to SELECT * FROM friends WHERE user_id='id'.

You can even make it a bit better by adding requests, where the other person get's notified of someone adding them as a friend and they have to decide whether or not to allow it. This would be accomplished by adding another field to the table called something like 'friendship_approved'.

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.