Welcome Guest, Not a member yet? Register   Sign In
Global Variables
#1

[eluser]albertleao[/eluser]
Hello!

I currently use a variable in MY_Controller.php and MY_Model.php to store my user object that I retrieve via phpactiverecord.

This means that I'm performing 2 queries to my DB every request. I'd like to only query once and have the object available to both my controllers and models. Any suggestions on how to do this?

I currently have the following code in my model and controller extensions:

Code:
$this->currentuser = User::find(1);





Theme © iAndrew 2016 - Forum software by © MyBB