How to pass an array in a WHERE condition

4
$this->db->set('al_reg', $matricula);
$this->db->set('dataagendamento', $dataagendamento);
$this->db->where('cod_lab', $laboratorio);
$this->db->where('cod_horario', $horario_prova);
$this->db->where('cod_data', $data_prova);
$this->db->where('cod_assento', $assento[]);
$this->db->where('al_reg', NULL);
$this->db->update('P_chekin_Geral');

In this model, almost everything is updated correctly, just the% w / o of%, which is a vector from 1 to 22 for each laboratory.

Does anyone have any idea if there is a possibility of adding a vector of 22 where each record is recorded in sequence and then restarted? example:

lab acessento 
  1        1
  1        2
  1        3..
  1        22
  2        1
  2        2
  2        3..
  2        22
  3        1..
  3        22
    
asked by anonymous 18.10.2016 / 15:31

1 answer

4

Replace where() conventional with where_in() , the first only compares a value with a certain column ex: WHERE nome = 'fulano' . The second compares a series of values with a column the sql generated would look something like this: WHERE nome IN ('fulano', 'fuleiro', 'joão')

Change:

$this->db->where('cod_assento', $assento[]);

By:

$this->db->where_in('cod_assento', $assento);
    
18.10.2016 / 15:34