Fatal error: Call to a member function to() on a non-object in /hermes/bosweb/web200/b2009/ipg.agrobengalcom/shopnodinga |
[eluser]Sumon[/eluser]
I use same code for sending email in 2 different controller. First one works fine for me but second one shows me the following error. Quote:Fatal error: Call to a member function to() on a non-object in /hermes/bosweb/web200/b2009/ipg.agrobengalcom/shopnodinga/application/controllers/mist.php on line 114 here is portion of my controller code where i am getting error Code: $this->load->library('email');echo $_POST['email'];//Echo shows perfect email address what's wrong here ? help me to figure out.
[eluser]smilie[/eluser]
I just posted some rubish - do not mind it Cheers, Smilie
[eluser]Madmartigan1[/eluser]
Well, what happens when you var_dump($this->email) right before the call to send()?
[eluser]Sumon[/eluser]
Ops!! program execution stopped and give fatal error at line: Code: $this->email->to($_POST['email']); Code: var_dump($this->email) Quote:bool(false)
[eluser]Madmartigan1[/eluser]
Sounds like the email class isn't loading... Hm... Something funny going on in that controller? Using modules or anything? var_dump($this->load->library('email'))?
[eluser]Sumon[/eluser]
@srpurdy: Same result for _REQUEST @Madmar: i don't use any modules. and it's really surprising. same code works fine in different controller. when i use var_dump($this->load->library(‘email’)); as Code: $this->load->library('email'); Fatal error: Call to a member function to() on a non-object in /hermes/bosweb/web200/b2009/ipg.agrobengalcom/shopnodinga/application/controllers/mist.php on line 147
[eluser]Madmartigan1[/eluser]
Set logging to "4" in config.php, return your controller to its original state, run the controller, read the log file. There may be something there that will help you figure it out. Do a debug message right before the expected error if you have a hard time following the log. It's not loading the email class, it's hard to say why without more information.
[eluser]Sumon[/eluser]
Works Great your idea. I found my mistake. Loading email library twice. once from autoload and another from controller. i remove email from autoload and now it works fine. thanks Madmartigan1
[eluser]Madmartigan1[/eluser]
Still it is strange behavior. You should be able to load the class as many times as you want, but you figured out your problem and that's what matters. Now time to get back to work Update: It's probably better that you don't autoload the email class anyways. It is the #1 biggest library in Codeigniter. |
Welcome Guest, Not a member yet? Register Sign In |