CodeIgniter Forums

Full Version: Problem with libraries
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Welcome and sorry for my poor english.
I have big problem with libraries.
I writed my own library:

class Log_in

    function Log_in()
        echo $this->input->post('username');


This library is loaded by autoload.php file.
When I run this class in controller, I receive this error:

Fatal error: Call to a member function post() on a non-object in...

Can you help me?

El Forum

$this is private in the library, it is not the CI superobject.

$CI =& get_instance();

Check the userguide:

El Forum

Thank you rogierb.
It works!