(11-08-2016, 12:04 AM)Wouter60 Wrote: In your attachment, it looks like you name your controller "Controller.php". This is a recipe for trouble. Controller is a reserved name in CI for a specific type of class.
It's also very odd to address to a page on your website with a URL like www.mysite.com/controller/debtor_print_view, isn't it?
Rename the controller to Invoices.php. Don't forget to change the class name inside the controller too.
Your controller function starts with this line:
PHP Code:
$this>load>model('invoices_model');
It should be:
PHP Code:
$this->load->model('invoices_model');
Next, in your controller, you are loading this view:
PHP Code:
$this->load->view('backend/index', $page_data);
CI is looking for a view named application/views/backend/index.php.
But the view you mention in the attachment is named debtor_print_view.php. You can't expect your application to work that way.
Also, in your model, you have this line:
PHP Code:
$this->db->from('invoice ');
Remove the space character after invoice, because the Query Builder will try to open a table named "invoice ", which most likely not exists.
Last but not least, your view has a bunch of wrong code. Remove all of it. Just put this in your view, to test if the controller passes the data correctly:
PHP Code:
<?php
echo '<pre>';
print_r($get_debtors); //$get_debtors is passed by the controller via $page_data['get_debtors'];
echo '</pre>';
?>
Finally, run your application and call the url www.mysite.com/invoices/debtor_print_view
I sincerely appreciate your time and efforts in getting this View program work I observed after putting these statements in the Controller
$this->load->model('invoices_model');
$page_data['get_debtors'] = $this->invoices_model->get_debtors;
it blows up giving me this message
he localhost page isn’t working
localhost is currently unable to handle this request.
if I remove the statements above my program will run appropriately.
Thank you very much in advance looking into this issues for me