Welcome Guest, Not a member yet? Register   Sign In
Why am I running into "Message: Undefined variable: data" constantly?
#2

[eluser]Stefan Hueg[/eluser]
Congratulations, you have stumbled upon a misconception of the PHP language Smile Implicit variable declaration.

You will have to declare $data = array() before adding data to it. It's just a PHP notice, but something you should avoid. Declare that locally in your function right before adding data to it, not in your class.

In order to use the variables in your views you will have to pass them as a parameter:

Code:
$this->load->view('my_view', $data); //or
$this->parser->parse('my_view', $data);


Messages In This Thread
Why am I running into "Message: Undefined variable: data" constantly? - by El Forum - 04-30-2012, 11:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB