[SOLVED ]Undefined variable: config -- PHP error but email is sent. |
[eluser]kristo5747[/eluser]
Greetings! I am a *newbie* and just downloaded CI version 2.0.1. Please bear with me with this long email. I am attempting to write my own email controller like so: Code: <?php If I point my browser to "http://localhost/CodeIgniter/index.php/email", I get this PHP error message Quote:A PHP Error was encountered The line number 24 points to this line of code in my controller Quote:$this->load->library('email', $config); In spite of the PHP error, email is being sent fine, with a file attachment. How can I remove this PHP error? What am I doing wrong?
[eluser]kristo5747[/eluser]
Duh!!! I added $config = Array(); in my index() function. The error went away. Stupid, stupid, stupid me.
[eluser]Eric Barnes[/eluser]
That is because you are not setting $config. So change your line to: $this->load->library('email');
[eluser]louisl[/eluser]
Change $this->load->library('email', $config); to $this->load->library('email'); unless you actually need to change the default config in which case you'd do something like this:- Code: $this->load->library('email');
[eluser]kristo5747[/eluser]
[quote author="Eric Barnes" date="1302052414"]That is because you are not setting $config. So change your line to: $this->load->library('email');[/quote] I did what you suggested. Problem went way (makes sense). Thanks for the reply. |
Welcome Guest, Not a member yet? Register Sign In |