How to set up prepared query using IN statement

My solution to the problem:

$prepare = array();
        $in = implode(',', array_fill(0, count($product_ids), '%d'));
        foreach ($product_ids as $ids){
            $prepare[] = $ids;   
        }
        $prepare[] = "post";
        $prepare[] = $num;
        $results = $this->db->get_results($this->db->prepare("SELECT ID, post_title FROM {$this->db->posts} WHERE ID NOT IN({$in}) AND post_type=%s ORDER BY ID DESC LIMIT %d", $prepare));