title: Fatal error: Call to undefined method stdClass::My()
body: <p>I am getting this error when I call for the function My() for the second time. The first time (when I'm calling for the user_id) everything seems to be fine.. Stripped down code:</p>
  
  <pre><code>class User {
      function My($field) {
          global $user;
          global $db;
          global $sessions;
  
          if ($sessions == 2) {
              $user = $db-&gt;Row("SELECT * FROM users WHERE username='".$_SESSION['username']."'"); 
              return $user-&gt;$field;
          }
      }
  }
  
  $user = new User;
  
  class Index {
      function Startup() {
          global $user;
  
          $user_id = $user-&gt;My("user_id");
          $name = $user-&gt;My("firstname")." ".$user-&gt;My("surname");
      }
  }
  </code></pre>
  
  <p>Any suggestions would be greatly appreciated.</p>