 <p>Within your object your reference to your database is <code>$this-&gt;db</code> instead of <code>$db</code>. So you only need to change the <code>$db</code> references within your class to <code>$this-&gt;db</code>.</p> <p>Greetings :)</p>