# Creating a network

**URL:** <https://forum.kirupa.com/t/creating-a-network/260877>\
**Category:** programming\
**Created:** [May 20, 2008, 5:43pm UTC](https://forum.kirupa.com/t/creating-a-network/260877 "2008-05-20T17:43:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasonhardwick](https://avatars.discourse-cdn.com/v4/letter/j/c68b51/32.png) [@jasonhardwick](https://forum.kirupa.com/u/jasonhardwick)\
**Post date:** [May 20, 2008, 5:43pm UTC](https://forum.kirupa.com/t/creating-a-network/260877/1 "2008-05-20T17:43:54Z")

</div>

Ok here is my question…

I have a database of users and i want to be able to create a network that will allow you to search and add other users to your network what i am wondering is how to set that up in my users sql or do i need to create a new sql database.

any help or tutorials would be appreciated

---

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [May 21, 2008, 1:33pm UTC](https://forum.kirupa.com/t/creating-a-network/260877/2 "2008-05-21T13:33:24Z")

</div>

need 3 tables at least and know how to use relational databases.

table 1 (users)  
user\_id, network\_id, first\_name, last\_name, email, username, password

table 2 (networks)  
network\_id, network\_name

table 3 (users\_networks)  
users\_networks\_id, user\_id, network\_name

example tables would look something like

users

```auto

1 | 2 | lucas | williams | email@email.com | simplistik | zomgwtfpasswordsha1

```

networks

```auto

1 | my first network
2 | my second network
3 | my third network

```

users\_networks

```auto

1 | 1 | 2
2 | 1 | 3

```

so in all the tables the first number is auto\_incremented, users\_networks uses the auto\_incremented id’s from users and networks to associate a user and it’s network. So in entry 1 of the users\_networks table it says user #1 is associated with network #2 and network #3.
