kobel4k3r5 Posted September 15, 2006 Share Posted September 15, 2006 how would i go making a friends list? i have somewhat of a way in mind but I'm not sure if this way will be efficient. it would use each row as a user, and each row will have lots of columns and some of the columns will be buddyid1, id2, etc.. Quote Link to comment Share on other sites More sharing options...
btherl Posted September 15, 2006 Share Posted September 15, 2006 A better structure is to have one row for each friend relationship. You'll need 2 tables.The first table will store the user's name, user id and other data (password, name, etc etc).The second table will have two columns, "id1" and "id2". A row in that table means "id2 is a friend of id1".The problem with using columns is that you don't know how many columns you need. Rows make life much easier :) Quote Link to comment Share on other sites More sharing options...
fenway Posted September 15, 2006 Share Posted September 15, 2006 And more than that, good luck counting how many friends someone has if you have to count non-NULL columns... ugh. Any duplicity in rows/columns is bad. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.