我有一个值数组,我想使用 mysql IN() 函数进行检查,但是如何将它与 codeigniter 一起使用?
这就是我目前正在做的,显然行不通。
$p = array('page1', 'page2', 'page3','page4', 'page5');
$pages = implode(",", $p);
$sql = "select page from pages where domains_id = ? and page in(?) and is_deleted=0";
$fields = array($domains_id, $pages);
$this->db->query($sql, $fields)
the output of the pages variable comes out to page1,page2,page3,... but the in function needs them seperated like this:
'page1','page2','page3'....