changed all instances of the $dbr variable to $db