Welcome Guest, Not a member yet? Register   Sign In
Call to undefined function
#1

[eluser]tomitzel[/eluser]
Hello,
I've build this function that gets 5 random products, but I get this error message:
Code:
Fatal error: Call to undefined function _getfiverandomproducts() in /home1/nbxhostc/public_html/tomitzel/application/controllers/main.php  on line 24
But here is my controller with the function defined:
Code:
<?php

class Main extends Controller{
    
    function Main(){
        parent::Controller();
        $categories = $this->category_model->GetCategories();
        $this->template->set('categories_list', $categories);
    }
    
    function _getFiveRandomProducts($count){
        $products = $this->product_model->GetProducts();
        $random_products = array();
        $counter = 0;
        for($i = 0; $i < $count; $i++){
            $random_products[$counter++] = $products[rand(0, count($products))];
        }
        return $random_products;
    }    
    
    function index(){        
        $data = array(
        'title' => 'Colon Free Zone',
        'random_products' => _getFiveRandomProducts(5)
        );
        $this->template->load('template', 'homepage', $data);
    }    
}
Any suggestion what is wrong here, I think i'm missing here something very obvious Smile


Messages In This Thread
Call to undefined function - by El Forum - 03-22-2010, 07:16 PM
Call to undefined function - by El Forum - 03-22-2010, 11:31 PM
Call to undefined function - by El Forum - 03-23-2010, 03:26 AM
Call to undefined function - by El Forum - 03-23-2010, 07:58 AM
Call to undefined function - by El Forum - 03-23-2010, 12:39 PM



Theme © iAndrew 2016 - Forum software by © MyBB