Welcome Guest, Not a member yet? Register   Sign In
Problem with Codes
#9

(11-06-2016, 07:03 PM)Jay01 Wrote:
(11-06-2016, 02:59 PM)Wouter60 Wrote: You're on the right track, but there are a lot of basic mistakes in your code.
It seems that you have a controller with a function named "debtor_print_viewNEW()".
But you also have a model with a function with the same name!
It's guaranteed that this will cause confusion.
I recommend renaming the model function to something like "get_debtors()", and the controller function just "debtors".
It's bad practice to use capital letters in function names.

Right now, the controller function is even calling itself, causing an infinite loop.
You have this inside the debtor_print_viewNEW() function:
PHP Code:
$query $this->debtor_print_viewNEW(); 

Where I think you should do this:
PHP Code:
$this->load->model('invoices_model');  //application/models/Invoices_model.php
$page_data['get_debtors'] = $this->invoices_model->get_debtors();  //call get_debtors function in Invoices_model.php 

Next, setup your model function without the join statements for a start. Just to make sure that it will return records from your database. You can extend later on.
PHP Code:
function get_debtors() 
{
 
  $this->db
   
->select('*')
 
  ->from('invoice')
 
  ->where('status''debtor'); 
 
  $query $this->db->get(); 
 
  return $query->result_array();   
  
//use result_array if you want to handle the result as an array in your view, like you are doing.
  

The controller loads a view with this name:
PHP Code:
$this->load->view('backend/index'$page_data);  //load view named application/views/backend/index.php' 

Make sure this view exists!
Thanks and God Bless I appreciate Ur efforts in helping out
You are a Codeigniter Guru indeed You are accurate I eventually came up with an error please see it below 
An Error Was Encountered

Unable to determine what should be displayed. A default route has not been specified in the routing file.

God Bless
Reply


Messages In This Thread
Problem with Codes - by Jay01 - 11-05-2016, 11:44 PM
RE: Problem with Codes - by Wouter60 - 11-06-2016, 07:07 AM
RE: Problem with Codes - by Jay01 - 11-06-2016, 12:28 PM
RE: Problem with Codes - by Wouter60 - 11-06-2016, 02:59 PM
RE: Problem with Codes - by Jay01 - 11-06-2016, 07:03 PM
RE: Problem with Codes - by Jay01 - 11-07-2016, 11:48 PM
RE: Problem with Codes - by Jay01 - 11-07-2016, 10:52 AM
RE: Problem with Codes - by Wouter60 - 11-07-2016, 11:46 AM
RE: Problem with Codes - by Jay01 - 11-07-2016, 08:29 PM
RE: Problem with Codes - by Wouter60 - 11-08-2016, 12:04 AM
RE: Problem with Codes - by Jay01 - 11-08-2016, 01:59 AM
RE: Problem with Codes - by Wouter60 - 11-08-2016, 08:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB