title: mysqli prepared statement bind param array of ids
body: <p>I have simple prepared statement, and i can't find solution to bind list of id's, so as you can see in first statement i get all ids that i need, and in next statement i need to put all those ids into IN clause, but i'm not able to do it, any suggestions how and what is best way to do it ?</p>
  
  <pre><code>$stmt = $mysqli-&gt;prepare("SELECT id FROM user WHERE groupId = ? ORDER BY id LIMIT ? OFFSET ?");
  $stmt-&gt;bind_param("iii", $args['groupId'], $pageSize, $offset);
  $stmt-&gt;execute();
  $stmt-&gt;bind_result($id);
  
  $userIds= array();
  
  while ($stmt-&gt;fetch()) {
      $userIds[] = $id;
  }
  
  $stmt= $mysqli-&gt;prepare("SELECT a.id as attendantId, a.firstName, a.lastName, c.id as caringId, c.startDate, c.endDate FROM attendant a LEFT JOIN caring c ON c.attendantId = a.id WHERE a.id IN (?)");
  $stmt-&gt;bind_param('i', $userIds);
  $stmt-&gt;bind_param('i', implode(',', $userIds));
  </code></pre>