0
I have a code that lists several reports. These reports are saved in the database and to call them I use the Model in the Codeigniter. Inside the model, I have one where
and to make it work perfectly, with the information I want, I need to take a data of the user who is viewing this list.
Example: Be able to take the status that the user is registered, to put inside the where
.
For the time being 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 that where('user.u_uf', 'SC');
the SC that needs to be the data taken from the user.
If you reference a variable instead of the
'SC'
doesn’t solve? something like$_POST["uf_usuario"]
?– Marllon Nasser
@Marllonnasser I tried to put a variable, but I did not succeed in trying to pass the state to her
– Ketlin
Post your form code with the... edit action in your question :)
– Marllon Nasser
that user would be the logged in user?
– Marcelo Diniz