I have a code that lists several reports. These reports are saved in the database and to call them I use the Model in CodeIgniter . Within the model, I have a where
and to make it work perfectly, with the information I want, I need to get a data from the user who is viewing this list.
Example : Get the status that the user is registered to put inside where
.
For now this is my model:
$this->datatables->select('relatorios.l_id, relatorios.l_tipo_inspecao, empr.e_nome, relatorios.l_data_hora, user.u_nome, relatorios.l_status');
$this->datatables->from('relatorios');
$this->datatables->join('user', 'relatorios.u_id = user.u_id');
$this->datatables->join('dispo', 'relatorios.d_id = dispo.d_id');
$this->datatables->join('empr', 'empr.e_id = user.e_id');
$this->datatables->where('user.u_uf', 'SC');
return $this->datatables->generate();
In this% w SC that needs to be taken from the user.