O'Reilly logo

PHP 5 Social Networking by Michael Peacock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding friends

Our users can see other users on the site, either by searching for them or viewing a list of users; from here we can add a link to enable the user to form a relationship. We have a suitable database structure to facilitate this, but we now need functionality to connect our users together.

Forming a relationship

Let's walk through what the process should be for our users to form relationships with each other:

  1. View the listing of the user they wish to connect with.
  2. Click on a link, or select a relationship type from a list and click on Submit.
  3. Check for pre-existing relationships.
  4. Check if the relationship type selected is active.
  5. Create the relationship in the database.
  6. If the relationship type is mutual, e-mail the other user an approval ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required