Update database.php fixed multiple instances

Fixed the problem with using multiple database instances and reusing them.