[eluser]Alfonso Martinez[/eluser]
I am trying to load the results form a query to a view directly. This is for display the user information in the header view. The header view is an include en all the view in my application.
This how I am trying:
perfil_model.php
Code:
class Perfil_model extends Model {
function headerUserInfo() {
$query = $this->db->query('SELECT IdUsuarioWeb, Nombre FROM Usuarios_Web WHERE IdUsuarioWeb = 123');
$data = null;
if($query->num_rows() > 0) { // if results
foreach ($query->result() as $row) {
$data[] = $row;
}
}
return $data;
}
}
----
header.php
Code:
$this->load->model("perfil_model");
$data['perfil'] = $this->perfil_model->headerUserInfo();
echo $perfil->Nombre;
This, of course, is giving me an error.
What more can I do or try for that?