So I made a following system and that is obviously based around the users that exist in my "users" table. I just a made a posts system where users can post things. I am trying to make a feed where the user (user1) get the posts from all the users that (user1) is following (user2, user3, etc.). This is what I have so far
//Query for the people that I am following
$getfollowing = mysqli_query($dbconx, "SELECT * FROM follows WHERE follower='$log_username'");
while($rowf = mysqli_fetch_array($getfollowing)){
$following = $rowf['followed'];
$follower = $rowf['follower'];
}
//Query for the post of the people that the logged in user is following
$query = mysqli_query($dbconx, "SELECT * FROM posts WHERE username='$following' OR username='$log_username' ORDER BY posttime DESC");
while($row = mysqli_fetch_array($query)){
$user = strip_tags($row['username']);
$title = strip_tags($row['posttitle']);
$post = strip_tags($row['post']);
$time = strip_tags($row['posttime']);
$time = date('<font color="#C3C3C3">l F j, Y</font> | g:ia', strtotime($time));
$query2 = mysqli_query($dbconx, "SELECT * FROM users WHERE username='$user'");
$row2 = mysqli_fetch_array($query2);
$fname = $row2['fullname'];
$ava = $row2['avatar'];
//User picture
$pic = '<img src="user/'.$user.'/'.$ava.'" width="100" height="100" style="border: 1px solid #000;" alt="'.$user.'">';
if($ava == NULL){
$pic = '<img src="images/avatardefault.jpg" height="100" width="100" style="border: 1px solid #000;" alt="'.$user.'">';
}
I am able to get my posts and ONLY get the posts from ONE other user that I follow. How can get all the posts from all the users that I follow instead of just one of them?