Welcome Guest, Not a member yet? Register   Sign In
problems with active record get_where function
#1

[eluser]introvert[/eluser]
Hello,

I have a simple line of code:

Code:
$query = $this->CI->db->get_where('blogs', array('id' => $id));

Heres how I declare var $CI inside the class:
Code:
var $CI;
    
    function __construct() {
        $this->CI =& get_instance();
    }

Which will produce the following error:

Fatal error: Call to a member function get_where() on a non-object

What am I doing wrong?

Thanks for help!
#2

[eluser]Dam1an[/eluser]
I'm assuming you're doing your database calls in a model so you don't need to worry about the CI super object, and can just use $this->db->




Theme © iAndrew 2016 - Forum software by © MyBB