title: PHP PDO and DELETE with in() not working
body: <p>Here is the code for the class:</p>
  
  <pre><code>    class Delete_Category extends Category {
  
      private $idchain = array();
  
      public function __construct($id) {
          parent::__construct();
          $this-&gt;check_id($id);
          $this-&gt;get_delete_ids($this-&gt;id);
          $this-&gt;delete_category($this-&gt;idchain);
      }
  </code></pre>
  
  <p>// Get all the Children IDs from the DB and store them in the array</p>
  
  <pre><code>    private function get_delete_ids($id) {
          $this-&gt;query = $this-&gt;db-&gt;prepare("SELECT id FROM `shop_categories` WHERE parent_id = :id");
          $this-&gt;query-&gt;execute(array("id" =&gt; $id));
          while($result = $this-&gt;query-&gt;fetch(PDO::FETCH_ASSOC)) {
              $this-&gt;get_delete_ids($result['id']);
          }
          $this-&gt;idchain[]= $id;
      }
  </code></pre>
  
  <p>// Implode the array into an id string and throw it in the query</p>
  
  <pre><code>    private function delete_category($id_array) {
          $id = implode(",",$id_array);
          try {
              $this-&gt;query = $this-&gt;db-&gt;prepare("DELETE FROM `shop_categories` WHERE id IN (:id)");
              $this-&gt;query-&gt;execute(array(':id' =&gt; $id));
          }
          catch(PDOException $e) {
              // log it{
          }
      }
  }
  </code></pre>
  
  <p>The thing is that this always ends up with only the last ID being deleted. The query seems to be working however because it looks totaly fine if i echo it and replace :id with $id.</p>
  
  <p>// SQL output string if echoed:</p>
  
  <pre><code>DELETE FROM `shop_categories` WHERE id IN (11,6)
  </code></pre>
  
  <p>// If i manually add this to the Database it works as intended so the problem has to be somewhere at the PDO statement... Can anyone help me?</p>