function create_db_instance() { require 'db_settings.php'; try { $db = new CMySQL(); $db->connect($db_server, $db_username, $db_password); $db->selectDatabase($db_database); return $db; } catch (Exception $e) { echo 'Virhe tietokantayhteydessä!'; } return null; }