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 8469395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:12:58+00:00 2026-06-10T16:12:58+00:00

First I’m really new to fuelphp, you can down vote the question if needed.

  • 0

First I’m really new to fuelphp, you can down vote the question if needed.
My problem is that i made a facebook similar wall, and i don’t really understand the comments logic.

So i tried to join my tables this way

static function get_stream()
    {
        $query = DB::select()->from('stream_post');
        $query->join('users_metadata');
        $query->on('stream_post.user_id', '=', 'users_metadata.user_id');
        $query->join('stream_comment');
        $query->on('stream_post.stream_id', '=', 'stream_comment.stream_id');
        $query->order_by('stream_post.stream_id', 'DESC');
        $result = $query->execute();
        if(count($result) > 0) {    
            foreach($result as $row)
            {
                $data[] = $row;
            }

            return $data;
        }

    }

the problem with this is that, this only shows the stream posts what have comments, and doesn’t show the others.

So can please someone give me a logic how to join the tables to show those post to what doesn’t have a comment?

  • 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-06-10T16:12:59+00:00Added an answer on June 10, 2026 at 4:12 pm

    Try that:

    static function get_stream()
        {
            $query = DB::select()->from('stream_post');
            $query->join('users_metadata');
            $query->on('stream_post.user_id', '=', 'users_metadata.user_id');
            $query->join('stream_comment', 'RIGHT'); // The RIGHT JOIN keyword returns all rows from the right table, even if there are no matches in the left table.
            $query->on('stream_post.user_id', '=', 'stream_comment.user_id');
            $query->order_by('stream_post.stream_id', 'DESC');
            $result = $query->execute();
            if(count($result) > 0) {    
                foreach($result as $row)
                {
                    $data[] = $row;
                }
    
                return $data;
            }
    }
    

    Edit:
    That query should work (when every user_id from stream_post has the same user_id in users_metadata. Just transfer this query to fuelphp (I didn’t use it before).

    SELECT *
    FROM stream_post
    RIGHT JOIN stream_comment
    ON stream_post.stream_id = stream_comment.stream_id
    JOIN users_metadata
    ON stream_post.user_id = users_metadata.user_id
    ORDER BY stream_post.stream_id DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, let me state that I am very new to Bash scripting.
First I want to say you that I'm totally new in Xcode so I'm
First off, I'm new to LINQ, so I don't really know the ins and
first off I'm a noob to PHP but here is my problem. I am
First i selected images from photo library to ALAsset Library and after that i
first sorry if its a stupid question but im lost a bit. So when
First of all I have to admit that these are very basic and primitive
First of all I'm sorry for such a question, I look over the internet
First of all, I'm a Rails newbie. I can hold my own in Ruby,
First things first, here is a little snippet code to help explain my problem:

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.