簡體   English   中英

或類似我的SQL查詢(使用CodeIgniter生成)無法與jQuery DataTables一起使用

[英]or like in my SQL query (generated with CodeIgniter) not working with jQuery DataTables

我有一個像這樣的數組:

$expl = Array([0] => 51465, [1] => 411002); 

我想包含像郵政編碼的所有記錄51465411002 為了得到這個我嘗試了:

foreach ($expl as $exp) {
    $this->datatables->or_like('vendor.zip', $exp);
}

但這向我顯示了以下錯誤:

調用未定義的方法Datatables :: or_like()

有人可以告訴我解決方案或其他替代方法嗎?

請使用數據庫Codeigniter對象db,也可以使用自定義數據表。 我建議您使用db對象。

$this->db->or_like('vendor.zip', $exp);

但是您還應該使用“ IN”查詢。

$names = array(51465, 411002);
$this->db->where_in('vendor.zip', $names); // Here vendor is alias of table name 
// Produces: WHERE vendor.zip IN (51465, 411002)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM