Hello, im trying to create a niche social network. Im working on the "add a friend" part an im not sure how to go about doing this. im using MySQL and PHP I have a table users and there is a userId primary key. I want a user to be able to add friends, what do i need to create for the user to store friend info?...and how do they associate another? Thanks!
You need to establish a user -> friend relationship using a link (association) table. It can be as simple as creating a User_Friend table as follows: User Table UserRecID FirstName LastName etc. User_Friend Table UserRecID FriendRecID User Table 1, Fred, Smith 2, John, Doe 3, Sarah, Davis 4, Kim, Jones User_Friend Table 1,2 (Fred has friend John Doe) 1,4 (Fred has friend Kim Jones) 4,2 (Kim has friend Jone Doe) etc. I should note that this may or may not meet your requirements, but wanted to give you something to think about. Good luck.
Thanks for your reply, It makes sense, I will try and let you know how it goes. Either way +rep. thanks!