Welcome Guest, Not a member yet? Register   Sign In
Cannot pass variables from Controller to Model
#8

Public controller properties can be accessed within model context in the way $this->test_message , "magic" is used for this. But I don't use this feature for passing values, it is handy for accessing objects that the controller contains. Within a model you can write $value = $this->session->userdata('value'); instead of $CI = &get_instance(); $value = $CI->session->userdata('value');

Anyway, if you want to pass to the controller a property value (don't like this), better declare it within the corresponding controller public $test_message;

[]
Reply


Messages In This Thread
RE: Cannot pass variables from Controller to Model - by ivantcholakov - 05-29-2016, 12:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB