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; }
* Dolphin is free software. This work is licensed under a Creative Commons Attribution 3.0 License. * http://creativecommons.org/licenses/by/3.0/ * * Dolphin is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the Creative Commons Attribution 3.0 License for more details. * You should have received a copy of the Creative Commons Attribution 3.0 License along with Dolphin, * see license.txt file; if not, write to marketing@boonex.com ***************************************************************************/ require_once "header.inc.php"; require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php'; define('DB_FULL_VISUAL_PROCESSING', true); define('DB_FULL_DEBUG_MODE', false); define('DB_DO_EMAIL_ERROR_REPORT', true); $MySQL = new CMySQL(); if (!$MySQL->connect()) { genMySQLErr('Database connect failed'); } if (!$MySQL->select_db()) { genMySQLErr('Database select failed'); } db_res("SET NAMES 'utf8'"); $cacheParam = array(); class CMySQL { var $host = DATABASE_HOST; var $sock = DATABASE_SOCK; var $port = DATABASE_PORT; var $user = DATABASE_USER; var $passwd = DATABASE_PASS; var $db = DATABASE_NAME;