So this has been asked a few times, but I'm really hoping that someone has come up with a better way. I need to create a friends table that can represent if one person is a "friend" of another. This would be used for both displaying all friends of person A and also to check to see if person X is a friend of person A.
The most popular (from what I have found) implementation of this is also discussed here as option one, http://phpbuilder.com/board/showthread.php?t=10306549&highlight=friend (sorry if that's the wrong way to link to other threads in this forum).
Basically, create a table where you have User and Friend as your fields, and for each friend of a user, you would have an entry in the table. So if person A is a friend of person B, C, and D, you would need three entries in the table: (A,😎, (A,C), (A,D)...
But since B, C, and D are now friends with A, you would also need (B,A), (C,A), and (D,A) in the table which are basically duplicates of A's friends.
I understand that there would be ways to avoid creating these duplicates, but you would need to add some extra code to check both fields when seeing if one person is a friend of another... or you could just put the duplicates in and have a larger table but not have to do extra checking... so it seems like both methods are basically the same just sacrificing different things...
So the question is, does anyone know of a better way to do this or is this system still the only way to do this? Any suggestions/comments are appreciated.
Brendan