Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4125668
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:54:00+00:00 2026-05-20T23:54:00+00:00

Okay I’m having a problem. I have a social networking site and have some

  • 0

Okay I’m having a problem. I have a social networking site and have some code that will call statuses from only friends. I want it to call both statuses from friends as well as the user logged in. Kind of the way facebook does.

Tables: members, friends, status

members – Handle

friends – Username, Friend

status – Handle, Type(public or friends)

Here is code that will show the most recent status from a user’s friends.

$shawing = "SELECT *
FROM status
JOIN friends
ON status.Handle = friends.Friend where friends.Username='$members[Handle]' and status.Type='friends' ORDER by status.Id DESC" or print mysql_error();

$members[Handle] calls from an include that identifies the user who is logged in.

Someone told me a Union would work, but I’ve only been able to make one status show up and the code I have now only has one result.

Basically, I want to take the list of usernames from the person’s friends list and add the user logged in’s username and show only statuses from the friends section with those usernames.

Also, it would be great if I could get a structure for the code because I’m new to the whole JOIN and UNION. I understand it, sure, I just don’t understand how it’s properly setup.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T23:54:01+00:00Added an answer on May 20, 2026 at 11:54 pm

    The more UNION and JOIN’s you use the more overhead you start to accumulate. Once you try to scale this by 10,000 records you’ll start seeing this query in your servers slow query log.

    I suggest keeping it simple and run two queries.
    1st query: Get the users status
    2nd query: Get the users friends status’

    The first query should be very fast as you’re most likely using the users userid (primary key on the table, yes?). Some times the best way is to just keep things simple.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, I'm having some serious issues here. I'm new to this site, and new
Okay, here's the scenario. I have a utility that processes tons of records, and
Okay, so I've got some C code to perform a mathematical operation which could,
Okay, I'm creating a program from a single class, let's call it John class.
Okay so im working on this php image upload system but for some reason
Okay, we know that the following two lines are equivalent - (0 == i)
Okay, I've been struggling with this for a while now. I have a standard
Okay, I have read, and tried a lot of things on how to implement
Okay this is the css code I put on the master page so it
Okay, I've looked all over the internet for a good solution to get PHP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.