• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
db not appearing in module.

$this->db->set('campaign'$campaign);  //set the last campaign used

I am autoloading database.php and all is OK. I have another module that is being spawned by koolreports render() command. In it I have no access to $this. So when I try to access the db from it $this->db fails. I was having the same issue with sessions. Someone up here recommended using:

$CI = & get_instance();
$this->MyModel = $CI->MyModel;
$this->session = $CI->session;

which worked great. 

Any idea how i can get analagous access to the db (which is already open) in another module? 
proof that an old dog can learn new tricks

There you go again with the small font size.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

Sorry. I fixed that. At this point I have changed my mind and am not planning to keep the last year "run". I am still having an issue with this module, however. I can't seem to get the form to respond right away. Rather, it is delayed until after i press submit again.
proof that an old dog can learn new tricks

If you use the autoload config to connect to the database ($autoload['libraries'] = array('database')).
Then just define the db property

$this->db = $CI->db;

Else add initialization


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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