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?
Try that:
Edit:
That query should work (when every
user_idfromstream_posthas the sameuser_idinusers_metadata. Just transfer this query to fuelphp (I didn’t use it before).