helper problem

I've taken over a ci project made in some old version (1.6ish) and upgraded it to 1.7.2, but I have a repeating problem on a few helpers and the usage of db.
in my controller I can do a regular $this->db->xxx. No problem. So I move this to a helper using $CI = &get;_instance(); But here I get an error on $CI->db->xxx stating db is an undefined property. Strange, I thought that &get;_instance gave a reference to the working ci object and hence one with db since I could do the db-> before a call to a function in the helper.

Any thoughts ?

I assume you mean
$CI =& get_instance();

Yes. Typo. My bad. Of course $ci = & get_instance();

If you do a
$CI =& get_instance();
What do you get?

function get_active_languages()
$CI = &get;_instance();


object(user)#23 (10) {...}

Anything specific I have to look for in the Obj. Its quite large as you know?

the only way that $CI->db is undefined is if the database has not been loaded, or if some processes has unset the db property.
is your database autoloaded? (i would suggest probably not)
if the helper being called in an instance in which the database has not been previously loaded?

I asked so many times to so many people to give a clear answer of my question,but no one gave the right answer.Can any one give me the right answer of my question?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.