SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2009
    Location
    Limbo
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Facebook style friendlist

    hi there,

    I've been making a small social media app and as most social media apps it must have a friends list. I've organized my friends table very simply. It contains 3 fields: id, friend1, friend2. I'm not certain this is the best method but so I've been told.

    I know very basic MySQL but trying to learn more advanced combinations of sql functions. What I want to achieve is selecting all the friend1 or friend2 that is not = to username but the username must be one of friend1 or friend2.

    I'm also trying to join tables, to obtain the user data, so SELECT username, picture from the database.

    Could anyone point me in the right direction?

    It would be greatly appreciated.

  2. #2
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,708
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The id field is not necessary. you'd have an id for Friend1 and an id for Friend2, the additional id field offers no necessary information.

    Did you search the forum for FRIEND since the question is likely to have been asked and answered a number of times?

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2009
    Location
    Limbo
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Woops. Sorry about that. Haven't been using sitepoint in a while. Got my answer. Thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •