title: Trying to get property of non-object php error
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/7625941/call-to-a-member-function-on-a-non-object-works-localhost-but-not-online">Call to a member function on a non-object - works localhost but not online</a>  </p>
  </blockquote>
  
  
  
  <p>don't know how to solve this problem, it's basic but can't find a solution.
  I use two files: connect.php and user.php.</p>
  
  <p>in connect.php is a Connect class:</p>
  
  <pre><code>class Connect{
  var $logged;
  function login($username, $password){
      ..more code..
      if($pass==$password){
          $this-&gt;logged=true;     // db connection is fine, this works
                                  // checked it with echo $this-&gt;logged;
      }
  }
  }
  </code></pre>
  
  <p>and when i call it from another file, user.php like this:</p>
  
  <pre><code>$user=new Connect;
  $user-&gt;login();
  echo $user-&gt;logged;      // ERROR  Trying to get property of non-object 
  </code></pre>
  
  <p>Why is this code not working, but it works offline (locally)???</p>