Uhm.. Why shouldn't the $db be set?