Reputation: 1
View code
<?php foreach($payment as $test){?>
<tr>
<td><?php echo $test->customerName;?></td>
<td><?php echo $test->dateTime;?></td>
<td><?php echo $test->amount;?></td>
</tr>
<?php }?>
Controller code
function __construct() {
parent::__construct();
$this->load->database();
$this->load->model('Income_sales_model');
}
public function index()
{
$this->data['pja_test'] = $this->Income_sales_model->get_all();
$this->load->view('income_sales_view', $data);
}
**AND HERE IS MY ERROR **
I'm stuck here I don't know what to do..
Upvotes: 0
Views: 46
Reputation: 282
Controller code
function __construct() {
parent::__construct();
$this->load->database();
$this->load->model('Income_sales_model');
}
public function index()
{
$data['payment'] = $this->Income_sales_model->get_all(); // $query->result();
$this->load->view('income_sales_view', $data);
}
Upvotes: 0
Reputation: 604
the variable you are trying to access must be a key of $data
...
So,print_r($pja_test);die;
in your view you will get the appropriate output
If still any issue let me know
Upvotes: 1