I want to make a dynamic WHERE clause to find posts by multiple posters. This is my code so far.
$in = join(',', array_fill(0, count($myArray), "?"));
$query = "SELECT * FROM posts WHERE poster IN ($in)";
$statement = $conn->prepare($query);
$statement->bind_param(str_repeat("s", count($myArray)), ...$myArray);
$statement->execute();
$result = $statement->get_result();
The above code is working but only for the very first person in my array. How will I be able to get the posts from every person listed in the array?