Welcome Guest, Not a member yet? Register   Sign In
another situation which cause Fatal error: Call to a member function on a non-object
#1

[eluser]EugeneS[/eluser]
tried to find the solution but i cant so here is description of the problem:

my home PC: php 5.x Apache 2.x windows
my work PC: php 5.x Apache 2.x windows

at work i run this code without any problems:

Code:
class Cart extends Controller {
    function Cart()
    {
        parent::Controller();
        ..........
        ..........
    }

    function Process()    
    {
        .........
        $this->load->library('somelibrary');
        .........
        $this->somelibrary->somemethod();

    }
}

BUT at home i receive this error:
Fatal error: Call to a member function somemethod() on a non-object in ......

this code start working at home only when i load library (or model) inside constructor but not inside any method Sad

any ideas ? i have no idea what the problem :\ any tricks to not change php config file (probably this difference depend on php configuration ) because i do not know where my site will be installed ...

sure i can load library in constructor so this will work everywhere but i do not want to do so when i use this library only in one method.... no need to load it all the time.

the same problem with loading models.


Messages In This Thread
another situation which cause Fatal error: Call to a member function on a non-object - by El Forum - 08-12-2007, 10:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB