THE SUMMARY:
When I call .../index.php/product, I receive:
Fatal error: Call to a member function get_prod_single() on a non-object in /var/www/sparts/main/controllers/product.php on line 16
The offending Line 16 is:
$data['pn_oem'] = $this->product_model->get_prod_single($product_id);
Looks like I don't know how to make this a working object. Can you help me?
THE CODE:
In my /Models folder I have product_model.php:
<?php
class Product_model extends Model {
function Product_model()
{
parent::Model();
}
function get_prod_single($product_id)
{
//This will be a DB lookup ...
return 'foo'; //stub to get going
}
}
?>
In my /controllers folder I have product.php:
<?php
class Product extends Controller {
function Product()
{
parent::Controller();
}
function index() {
$this->load->model('Product_model');
$product_id = 113; // will get this dynamically
$data['product_id'] = $product_id;
$data['pn_oem'] = $this->product_model->get_prod_single($product_id);
$this->load->view('prod_single', $data);
}
}
?>