When i instaniate the class with $db instead doing it over and over and over i want to pass the object into the new class.
$db = new mysql()
$account = new account($db)
So i pass $db into the class account which looks like this..
Code: Select all
function account($db) {
$this->db = $db;
var_dump($this->db); //This actually displays the correct information and class_exists verifies the class does exist
}
function resetPassword($email) {
$sql = $this->db->query("select * from users");
}
}
PHP Fatal error: Call to a member function query() on a non-object in account.class.php on line 9
Any thouhts?
Thanks,
Anthony