I have an Array of id's I follow if I echo:
echo json_encode($followingIds);
prints:
[{"User_two_id":"3"},{"User_two_id":"4"},{"User_two_id":"5"}]
I now want to select All id's from Post table where the value/s of Author are equal to the value of my User_two_id's in my array.
"Author is indexing id's of user_two"
Here is where I've got so far which is not working
function getPosts( $follwingIds ) {
$sql = "SELECT id
FROM posts
WHERE Author IN ('$follwingIds')
GROUP BY id
HAVING COUNT(DISTINCT Author)";
$result = $this->conn->query( $sql );
if ( $result != null ) {
while ( $row = $result->fetch_assoc() ) {
$returnArray[] = $row;
}
}
}