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

(This post was last modified: 05-29-2016, 09:33 AM by PaulD. Edit Reason: Added PS )

Hi,

I thought that models and controllers were all part of the same context. A site I am building right now, I decided to set user_id as in the controller construct so I can access it in any called models and controller methods without having to fetch it all the time from the user_model nor pass it every model call.

It is working fine, but are you saying that this is a bad idea? Or that is should not be working?

I do not use it to send any other info like messages or other variables, but user_id I am referring to in every database call and every method, so I thought it was a handy approach that I had not used before.

Paul.

PS Or is it because the OP was not extending the CI_controller that it was a problem?
Reply


Messages In This Thread
RE: Cannot pass variables from Controller to Model - by PaulD - 05-29-2016, 09:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB