Site icon Hip-Hop Website Design and Development

The way to arrange ready question utilizing IN assertion

I’m a tad bit confused on how I’d arrange a SQL IN assertion utilizing a ready question. Right here is the code:

$in = implode(',', array_fill(0, rely($product_ids), '%d'));
        $outcomes = $this->db->get_results($this->db->put together("SELECT ID, post_title FROM {$this->db->posts} WHERE ID NOT IN({$in}) AND post_type=%s ORDER BY ID DESC LIMIT %d", array(implode(',', $product_ids), "submit", $num)));

The end result returns null. The place am I fallacious?

UPDATE: Fastened my very own drawback. Right here is my answer for anybody questioning:

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