title: Can't set value to $_SESSION variable in MVC model
body: <p>I am trying to create a persistent session variable in a model in code igniter.
  This is what I have at the top of my model before the class starts:</p>
  
  <pre><code>session_start();
  $_SESSION['userscore'];
  </code></pre>
  
  <p>Inside the class I have this two functions:
  The first one I am trying to set the current score to the session variable so later on I can call it in the second function and return the current total score.The score reaches the function <strong>setscore</strong>. 
  I just cant understand how to set the variable at the top of the page with this value.I tough that the variable session is global. Any suggestions? Thanks</p>
  
  <pre><code>function setscore($score){
          $_SESSION['userscore'] = $score;
  
  }
  function getscore(){
          $totalscore = $_SESSION['userscore'];
          return $totalscore;
  }
  </code></pre>