I have a model method which returns time and view to pass the data. But when I pass the data I get Undefined variable error message.
$this->load->model('Driver_model');
$result = $this->Driver_model->get_shift_data($id);
This is the method calling and if I use var_dump($result). I get following result.
array (size=1)
0 =>
object(stdClass)[26]
public 'start_time' => string '2016-01-22 05:32:42' (length=19)
But if I send the $result to the view, I get error.
$this->load->view('driver/report_view.php', $result);
My question is, how it possible to work in controller if I don't load the view. But if I send the data, it doesn't identify the variable.
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: result
Filename: driver/report_view.php
Line Number: 52
Backtrace:
File: C:\wamp\www\cabs\application\views\driver\report_view.php
Line: 52
Function: _error_handler
File: C:\wamp\www\cabs\application\controllers\Driver.php
Line: 44
Function: view
File: C:\wamp\www\cabs\index.php
Line: 292
Function: require_once
I have tested it using var_dump($result) in view as well.
<div class="panel-body">
Line 52 <?php var_dump($result); ?>
<form>