-1
如何在使用codeigniter的查詢中實現何處,何時使用 $ this-> db-> where_in函數表示只需要輸入數組的第一個值,它將退出.I需要檢查與輸入如何在使用codeigniter的SQL中實現WHERE IN函數
如何在使用codeigniter的查詢中實現何處,何時使用 $ this-> db-> where_in函數表示只需要輸入數組的第一個值,它將退出.I需要檢查與輸入如何在使用codeigniter的SQL中實現WHERE IN函數
控制器代碼
$where[]=array("your_field_name IN (1,2,3) ");
的多個值,並通過此數組中模型your_method如I所示你下面
模型代碼
function your_method($where)
{
$this->db->select('your table.*');
if(!empty($where))
{
foreach ($where as $key => $value)
{
if(is_array($value))
$this->db->where($value[0], '', false);
else
$this->db->where($key, $value);
}
}
$q = $this->db->get('your_sql_table');
if($q->num_rows() > 0)
return $q->result_array();
else
return null;
}
嘗試 - > or_where() – meet
向我們顯示您的代碼。我們無法幫助你。 – AdrienXL