title: How to pass array values into prepared SQL WHERE IN statement?
body: <p>Trying to pass a 2D array into a prepared WP SQL statement.</p>
  <p><code>$idList</code> is the 2D array.</p>
  <p>This is what I have:</p>
  <pre><code>    $implodelist = &quot;.implode(',', $idList).&quot;;
      
      
      global $wpdb;
  
      $result = $wpdb-&gt;get_results($wpdb-&gt;prepare(&quot;
      SELECT wp_users.`user_email`,
         wp_wp_pro_quiz_statistic.`correct_count`,
         wp_wp_pro_quiz_statistic.`incorrect_count`,
         wp_wp_pro_quiz_category.`category_name`
      FROM wp_users
        INNER JOIN wp_wp_pro_quiz_statistic_ref
           ON wp_users.`ID` = wp_wp_pro_quiz_statistic_ref.`user_id`
        INNER JOIN wp_wp_pro_quiz_statistic
           ON wp_wp_pro_quiz_statistic_ref.`statistic_ref_id` = wp_wp_pro_quiz_statistic.`statistic_ref_id`
        INNER JOIN wp_wp_pro_quiz_question
           ON wp_wp_pro_quiz_statistic.`question_id` = wp_wp_pro_quiz_question.`id`
        INNER JOIN wp_wp_pro_quiz_category
           ON wp_wp_pro_quiz_question.`category_id` = wp_wp_pro_quiz_category.`category_id`
      WHERE wp_users.`ID` IN %s&quot;, $implodelist));
  </code></pre>
  <p>But the array (as a string) does not seem to be passed correctly into the %s placeholder.</p>
  <p>If I remove the prepared statement and have <code>&quot;.implode(',', $idList).&quot;</code> in place of <code>%s</code>, it works.</p>
  <p>How can I pass the array values into the SQL statement?</p>