title: How can I make a prepared statement with IN() and have a while loop for PDO in PHP
body: <p>I am new to PDO, and have got stuck on trying to create a prepared statement for using IN()</p>
  
  <p>I have an array of different URLs ($urls), which I use for the IN(). I am not getting any errors, but the results are not showing.</p>
  
  <pre><code>    $in = str_repeat('?,', count($urls) - 1) . '?';
      $qry = $this-&gt;pdo-&gt;prepare("SELECT categories_url,categories_id,parent_id,categories_name FROM categories WHERE categories_url IN($in)");
      $qry-&gt;execute($urls);
      while($row = $qry-&gt;fetch(PDO::FETCH_ASSOC)) {
          echo $row['categories_url'];
      }
  </code></pre>
  
  <p>When I test the query with $qry->fetchColumn(), then it seems to have 0 results. But if I do the same query in mysqli, it has multiple results.</p>
  
  <p>The things I am unsure about it, I dont think my prepared statement is quite right, or maybe its the execution. And I dont know how to do while loops with fetch_assoc with PDO prepared either. What have I done wrong?</p>