我尝试组合两个select语句,第一个语句选择用户正在关注的所有用户,第二个语句选择用户的所有注释以及他们所关注的所有其他用户:
$get_user = $user_data['username'];
$get_following = mysqli_query($con, "SELECT * FROM follows WHERE `follower` = '$get_user'");
$query = mysqli_query($con, "SELECT * FROM posts WHERE username = '$followe' OR username = '$get_user' ORDER BY date_added DESC LIMIT 0,5 ");
我尝试使用以下代码,但只有当用户关注多个人时才会提取一个条目:
$get_following = mysqli_query($con, "SELECT * FROM follows WHERE `follower` = '$get_user'");
$ffg =mysqli_fetch_assoc($get_following);
$ff = $ffg['follower'];
$query = mysqli_query($con, "SELECT * FROM posts WHERE username = '$ff' OR username = '$get_user' ORDER BY date_added DESC LIMIT 0,5 ");
有人可以帮忙吗?