Creating List Within DB

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
4Boredom
Forum Contributor
Posts: 176
Joined: Tue Nov 08, 2005 4:29 pm

Creating List Within DB

Post by 4Boredom »

Im trying to create a friends list in a database but dont know how to program the input structurally

If someone approves someone as a friend, i donno how to do it

whats easier?

A) FriendsId - Friend A - FriendB [this would be a hige list]

or

B) FriendID -- Friends

I donno how id put multiple entries in friends for b tho?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Creating List Within DB

Post by Christopher »

4Boredom wrote:A) FriendsId - Friend A - FriendB [this would be a hige list]
An A-B relationship table would be better. Yes, huge lists are what databases are good at.
(#10850)
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

I'd say you want a table Friend and another table FriendFriend. Bit of a weird name for a table but it describes the fact that there is a many to many relationship between Friend and errr... Friend :)
4Boredom
Forum Contributor
Posts: 176
Joined: Tue Nov 08, 2005 4:29 pm

Post by 4Boredom »

ok... any idea how id call that up from PHP to display? :/ with both A nd B columns?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Might I suggest a search of these forums for 'friend list' or 'buddy list' or 'social networking' or something of that nature? This topic has been discussed several times in the past.
Post Reply