• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Message: Undefined variable: data

#1
[eluser]ibnclaudius[/eluser]
I got Message: Undefined variable: data when running this:

Code:
<?php

class User extends CI_Controller {
function index() {
  $data['page_title'] = "Index";
  $data['body'] = 'Conteudo';
  $this->load->model('Usermodel');
  $this->Usermodel->get_user();
  $this->load->view('index.php', $data);
}
}

?>

Code:
<?php

class Usermodel extends CI_Model {
function get_user() {
  $this->db->get('users');
  return $data['query']->result();
}
}

?>

Code:
<ol>
&lt;?foreach($query as $row) {?&gt;
  <li>&lt;?=$row->name?&gt;</li>
&lt;?}?&gt;
</ol>


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.