0
Password change screen, form is ok, but variable to fetch information in bd giving error, in function Row()!
Follow VIEW:
case 'alterar_senha':
$iduser= $this->uri->segment(3);
if($iduser=NULL):
set_msg('msgerro', 'Escolha um usuário para alterar', 'erro');
redirect('usuarios/gerenciar');
endif; ?>
<div class="large-12 columns">
<?php if (is_admin() || $iduser == $this->session->userdata('user_id')):
$query = $this->usuarios->get_byid($iduser)->row();
erros_validacao();
get_msg('msgok');
echo form_open(current_url(), array('class'=>'custom'));
echo form_fieldset('Alterar Senha');
echo '<div class="large-7 columns">';
echo form_label('Nome completo');
echo form_input(array('name'=>'nome', 'disabled'=>'disabled'), set_value('nome', $query->nome));
echo form_label('Email');
echo form_input(array('name'=>'email', 'disabled'=>'disabled'), set_value('email', $query->email));
echo '<div class="large-7 columns>"';
echo form_label('Login');
echo form_input(array('name'=>'login', 'disabled'=>'disabled'), set_value('login', $query->login));
echo form_label('Nova Senha');
echo form_password(array('name'=>'senha'), set_value('senha'), 'autofocus');
echo form_label('Repita a senha');
echo form_password(array('name'=>'senha2'), set_value('senha2'));
echo anchor('usuarios/gerenciar', 'Cancelar', array('class'=> 'button radius alert espaco'));
echo form_submit(array('name'=>'alterarsenha', 'class'=>'button radius '), 'Salvar dados');
echo form_hidden('idusuario', $iduser);
echo form_fieldset_close();
echo form_close();
else:
redirect('usuarios/gerenciar');
endif; ?>
</div>
<?php
break;
Follows CONTROLLER with function:
public function alterar_senha(){
esta_logado();
set_tema('titulo','Alteração de senha');
set_tema('conteudo',load_modulo('usuarios','alterar_senha'));
load_template();
}
FOLLOWS MODEL :
public function get_byid($id=NULL) {
if ($id != NULL):
$this->db->where('id', $id);
$this->db->limit(1);
return $this->db->get('usuarios');
else:
return FALSE;
endif;
}
Keeping the same code and checking , returned the same error.
– Sérgio henrique
I tried to change the structure by setting the data in the controller, just calling the function in the View but generates the same error too
– Sérgio henrique
Changed the view code too, taking only the variable
$usuario
, instead of the section where you callrow
?– Wallace Maxters
It had changed but with a wrong variable, now I put and no longer gave the error. Only that did not return to me the fields filled, login user and email
– Sérgio henrique