Confusion regarding variables in a Model

Hi All,

I am a bit confused with using variables in a Model. If you see this page: the function get_last_ten_entries() uses $query while other functions use $this->title, $this->content etc. I am assuming they are referenced using $this->variablename because those variables are private to this Model class and each of them will be initialized separately for separate functions.

In other words $this->title in insert_entry() will be a different variable from $this->title in update_entry(). Just wanted to confirm if I am thinking right or not.


Correct, they are just defining the names above for clarity in reading the model. As you see in each method they are overriding the variable's value.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.