bing code

What Makes a Social Network Tick (Part Deuce)

What Makes a Social Network Tick (Part Deuce)


Ok, we’ve created our fancy login system for our site. Now what? How do my members intereact with each other? This bring us back over 5 years ago when first debuted. Every web programmer on earth went “gaga” over how such a simple method used for “friending” another member became so big! Today we have sites like friendster, facebook, and orkut that use the same theory behind virtually friending your friends!

Here’s how they do it:

If Member1 wants to friend Member2, a request is made via a link or action on Member1’s part.

Using a relational database, this is what this request will look like.

Member’s Table (this contains all of our members, it may also contain other information like name, password, and other profile information.)


Friend’s Table (This table is updated whenever a member invokes a “friending” action.)

memberID friendID  Confirmed
2  1  0

When the member represented by the “friendID” confirms that they would in fact want to be friends with the member represented by “memberID,” then “Confirmed” will be updated to “1” in place of “0.”

So now, our scripts will have a way to tell if one member is friends with another, how many friends any given member has, how many requests for friends a given member has.

MySQL Snippet for querying the number of friends of a given member

SELECT count(*)
FROM  Friends
WHERE memberID = 1
AND Confirmed > 0;
Kristen Bachmeier
Kristen Bachmeier
Kristen Bachmeier is Atilus' Director of Operations and helps to oversee all client accounts and day-to-day operations. Kristen also has a background in digital marketing, and has been working in the digital marketing space since 2012.

Recent Comments | 2 Comments
  • Kenneth Udut

    thanks for the sql snippet!  I was going to “roll my own” social networking software, but I ended up going with PHPizabi, even though it’s in beta. I’m constantly attempting to get an online networking community for the Naples, FL area but it’s hard. You never know what google will pick up!  Check out and let’s give us nerds a place to go.

  • Zach K.

    Hack the planet!

Recent Posts

Go to top of page