как объявить несколько идентификаторов, которые не должны быть выбраны в codeigniter

#codeigniter

#codeigniter

Вопрос:

Я хочу, чтобы идентификаторы не были выбраны, я пробовал этот код, но он не сработал.

     $this->coredb->select("u.id, username, email, firstname, lastname, email_signature");
    $this->coredb->join("core_utypes cu", "cu.id = u.id", "left");
    $this->coredb->where("(cu.utype = 3 OR u.utype = 3)");
    $this->coredb->where("(cu.utype = 6 OR u.utype = 6)");
    $this->coredb->where("status", 1);
    $ids = ("89, 108, 49, 109, 38, 54, 87, 90, 104, 74, 99, 111, 87, 84, 94");
    $this->coredb->where("u.id NOT IN", $ids); 
    $this->coredb->order_by("u.lastassigned", "asc");
    $query = $this->coredb->get("core_users u");
    return $query->row_array();
  

Ответ №1:

Если вы хотите использовать WHERE IN , то вам нужно использовать либо ->where_in или ->where_not_in .

 $ids = array(89, 108, 49, 109, 38, 54, 87, 90, 104, 74, 99, 111, 87, 84, 94);
$this->coredb->where_not_in("u.id", $ids); 
  

ДОКУМЕНТЫ: http://ellislab.com/codeigniter/user-guide/database/active_record.html