I'm new using codeigniter. I'm trying to display items from my database, but I don't know why it doesn't work. Could you help me, please?
My Controller
function Usuario extends CI_Controller{
function construct(){
parent::__construct();
$this->load->model('usuario_m');
}
public function modificar_usuario(){
$id_usuario = 1;
$this->load->model('usuario_m');
$data['resultado'] = $this->usuario_m->ver_datos_usuario($id_usuario);
$this->load->view('paginas/modificar_usuario',$data);
}
This is my Model:
public function ver_datos_usuario($id_usuario)
{
$this->db->select('nombre','apellido','nro_ci', 'direccion','email','telefono','password');
$this->db->where('id_usuario', $id_usuario);
$this->db->from('usuarios');
$query = $this->db->get();
return $resultado = $query->result();
}
And this is my view: (Edited)
<!DOCTYPE>
<head>
<html>
<body>
<?php
foreach ($data as $d){?>
<label>Nombre: </label>
<input type="text" value="<?php echo $d->nombre;?>" />
<?php } ?>
</body>
</html>
What I'm doing wrong?