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

Is it a bug in CodeIgniter 3 ?

It is very strange. If I set a variable in MY_Controller, any model can receive this value.

But if I set a variable in normal Controller, any model can not. receive this value.

I believe it is a bug because CodeIgniter 2.x works good, but CodeIgniter 3 doesn't.



Test

[Image: obY1dVD.jpg]

I set a variable in MY_Controller 
Code:
$this->test_message = 'this is a test';

[Image: Ko2oreo.jpg]

Echo this variable in Model
Code:
echo 'ttt: ' . $this->test_message;

It works.
[Image: IxrB8QB.jpg]

But if I set it in  normal Controller
[Image: JZoCqT4.jpg]

Error
[Image: BjldjTS.jpg]


I found this issue from upgrade my old website from Codeigniter 2 to 3.


How to solve this issue?
Personal blog: https://terryl.in
My personal project is called Dictpedia is currently using Codeigniter 3, welcome.
Reply


Messages In This Thread
Cannot pass variables from Controller to Model - by allenlee - 05-29-2016, 06:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB