title: Fatal error: Using $this when not in object context in
body: <p>i have this class for connect to <code>mysql</code> database using <code>php</code>/<code>mysqli</code>:</p>
  
  <pre><code>class AuthDB {
      private $_db;
  
      public function __construct() {
          $this-&gt;_db = new mysqli(DB_SERVER, DB_USER, DB_PASS, DB_NAME)
          or die("Problem connect to db. Error: ". mysqli_error());
      }
  
      public function __destruct() {
          $this-&gt;_db-&gt;close();
          unset($this-&gt;_db);
      }
  }
  </code></pre>
  
  <p>now, i have any page for list user : </p>
  
  <pre><code>require_once 'classes/AuthDB.class.php';
  
  session_start();
  
  $this-&gt;_db = new AuthDB(); // error For This LINE
  $query = "SELECT Id, user_salt, password, is_active, is_verified FROM Users where email = ?";
  $stmt = $this-&gt;_db-&gt;prepare($query);
  
          //bind parameters
          $stmt-&gt;bind_param("s", $email);
  
          //execute statements
          if ($stmt-&gt;execute()) {
              //bind result columnts
              $stmt-&gt;bind_result($id, $salt, $pass, $active, $ver);
  
              //fetch first row of results
              $stmt-&gt;fetch();
  
              echo $id;
  
  
          }
  </code></pre>
  
  <p>now, i see this error: </p>
  
  <pre><code>Fatal error: Using $this when not in object context in LINE 6
  </code></pre>
  
  <p>How to fix this error?!</p>