I have the following problem, I am working in Codeigniter
and then I am doing a small validation in the index
of my controller this is the code:
function index()
{
$user = $this->session->userdata("id");
$consulta = $this->cliente_model->get_roles_usuario($user);
foreach ($consulta as $row) {
if ($row->Url === 'cliente/index'){
$this->load->view('guest/head');
$this->load->view('guest/nav');
$this->load->view('guest/section');
$this->load->view('cliente/cliente_view');
}
}
redirect(base_url());
}
The query works well, I've already checked it, it gives me back what I want it to be:
- Url
- product / index
- provider / index
- client / index
If within the result of my query I have the same value as the one I placed in the if
, in this case it is, I would have to load the view. Otherwise redirect me at the beginning of my application, am I failing in foreach
?