Fatal error: Using $this when not in object context in
<p>I'm new to classes in php, can anybody tell me what I've done wrong here?</p>

<pre><code>&lt;?php 

class UserDb {

    const TABLE = "users";
    const KEY_ID = "Id";
    const KEY_EMAIL = "email";
    const KEY_JOIN_DATE = "joinDate";
    const KEY_VERIFIED = "verified";
    const KEY_LAST_LOGIN = "lastLogin";
    const KEY_FIRST_NAME = "firstName";
    const KEY_LAST_NAME = "lastName";
    const KEY_PASSPHRASE = "passphrase";

    private $db;

    function _construct() {
        $this-&gt;$db = new PDO(
                'mysql:host=' . HOST_NAME . 
                ';dbname=' . DATABASE_NAME . 
                ';charset=utf8', DATABASE_USER, DATABASE_PASS
        );
        $this-&gt;$db-&gt;setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
        $this-&gt;$db-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    }

    public function userExists($email) {
        $sql = $this-&gt;$db-&gt;prepare("SELECT * FROM " . TABLE . " WHERE " . KEY_EMAIL . " = :email");
        $sql-&gt;execute(array(':email' =&gt; $email));
        $row_count = $sql-&gt;rowCount();
        if ($row_count &gt; 0) { return true; }
        else { return false; }
    }   

    public function insertUser($user = null) {
        if (is_null($user)) { $user = new User(); } 
    }

}

?&gt;
</code></pre>

<p>Is there something wrong with my syntax, or did I just completely miss a point somewhere?  I'm supposed to add more details here to post this, but I'm not sure what else to add...</p>
