Hi, I am in dilemma, do not know which one is better. (I am using php and mysql btw)
Lets say I am developing a social community website. A user can add as many friends as he wants. In my database, I have a users table which store user's details include user's friends. Should I store the user's friends in:
Strings => john;bryan;sam;paul;...;
or
Integers => 1;21;50;1779;30;...;
String means store their username. Integer means store their user id.
Which one is better?
If string, it would be a very, very large string(imagine the users have 400 friends, and some usernames are extreme long)
If id, how to list friends on user profile page? Getting list of IDs in one long string (separated by semicolon), use explode function to make it into array. Then using loops to display?? Isn't troublesome? Is there any other way? If yes, please show some sample code..
OR normally, how would u guys to store the "friends" list in the user table?