Welcome Guest, Not a member yet? Register   Sign In
database modeling for a friend list
#1

[eluser]pabloheim[/eluser]
Im working a project and I have already implemented an auth library and all works fine. what I want to do now is to generate the possibility for each user to add friends to a list.

My question is how can I model it in a database, for example:

if there is a table named friends with 3 fields :
id1 : id of a user
id2 : id of another user
status : 0 or 1. if -> 1 id1 and id 2 are friends. if 0 id2 hasnt confirmed yet.

The idea is the following: if I invite a user to be my friend, a new row in this table is created , with the field status =0 and id1 = "my id" and id2= "the id of the other user". if he accept , then status = 1.

But this model has a problem, because its pretty difficult to retreive my friends list , since I have to search in both id1 an id2 fields.

do you have some ideas or a better model ?

thanks a lot!
sorry for my english


Messages In This Thread
database modeling for a friend list - by El Forum - 04-16-2009, 04:15 PM
database modeling for a friend list - by El Forum - 04-16-2009, 05:03 PM
database modeling for a friend list - by El Forum - 04-16-2009, 06:45 PM
database modeling for a friend list - by El Forum - 04-16-2009, 07:29 PM
database modeling for a friend list - by El Forum - 04-16-2009, 08:54 PM
database modeling for a friend list - by El Forum - 04-16-2009, 10:54 PM
database modeling for a friend list - by El Forum - 04-16-2009, 11:58 PM
database modeling for a friend list - by El Forum - 04-19-2009, 07:35 PM
database modeling for a friend list - by El Forum - 05-07-2010, 10:24 AM
database modeling for a friend list - by El Forum - 05-07-2010, 11:01 AM
database modeling for a friend list - by El Forum - 05-07-2010, 11:04 AM
database modeling for a friend list - by El Forum - 05-07-2010, 11:12 AM
database modeling for a friend list - by El Forum - 05-11-2010, 12:37 PM
database modeling for a friend list - by El Forum - 05-12-2010, 12:40 AM
database modeling for a friend list - by El Forum - 05-12-2010, 10:22 AM
database modeling for a friend list - by El Forum - 05-12-2010, 10:27 AM
database modeling for a friend list - by El Forum - 05-14-2010, 10:49 AM
database modeling for a friend list - by El Forum - 05-15-2010, 12:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB