am new to codeigniter and I want to develop todo app.now the problem is get data from database ,anyone findout and tell me what the error is,
get.php
<html>
<head>
<title></title>
</head>
<body>
<?php foreach($data as $row){?>
<tr>
<td><?php echo $row->task; ?></td>
<td><?php echo $row->status; ?></td>
<td><?php echo $row->description; ?></td>
<td><?php echo $row->date; ?></td>
</tr>
<?php }?>
</body>
</html>
Add_task.php(model)
public function get_user()
{
$this->load->database();
$data=$this->db->get('user');
return $data->result();
}
Welcome.php(controller)
public function get_task($data)
{
$this->load->model('Add_task');
$data=$this->Add_task->get_user();
$this->load->view('get',$data);
}
Am getting error like this
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: data
Filename: views/get.php
Line Number: 8
Backtrace:
File: C:\wamp\www\CodeIgniter-3.0.4\application\views\get.php Line: 8 Function: _error_handler
File: C:\wamp\www\CodeIgniter-3.0.4\application\controllers\Welcome.php Line: 43 Function: view
File: C:\wamp\www\CodeIgniter-3.0.4\application\controllers\Welcome.php Line: 33 Function: get_task
File: C:\wamp\www\CodeIgniter-3.0.4\index.php Line: 292 Function: require_once
$datais not defined in the get.php file. - ssc-hrep3