Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Call to a member function on a non-object
#5

[eluser]eggshape[/eluser]
Hey Neverstop:

Your error is that you don't have a contructor for your class Artigos. You need to define it using

Code:
function Artigos(){
//nothing needs to go here unless you want it to be automatically called when Artigos is instantiated
}

//or

function __construct(){
//same here
}

when you write $this->Artigos->do_something() , you're telling CI there is an instantiated object with that name that has a method called do_somehing.

If you want to access methods from Artigos without instantiating it as an object, you need to use 'static public function' to define your methods and then use it like this 'Artigos::do_something()', after including the file.

You can read more at php.net


Messages In This Thread
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 07:08 AM
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 09:32 AM
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 10:01 AM
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 10:10 AM
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 10:19 AM
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 10:53 AM
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 11:16 AM
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 02:08 PM
Fatal error: Call to a member function on a non-object - by El Forum - 01-16-2008, 02:20 PM
Fatal error: Call to a member function on a non-object - by El Forum - 01-17-2008, 04:21 AM
Fatal error: Call to a member function on a non-object - by El Forum - 09-07-2012, 01:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB