// connect to the database
$dsn = 'mysql:hostname='._DB_HOSTNAME.';dbname='._DB_DBNAME.';charset=utf-8';
$db = $GLOBALS['db'] = new PDO($dsn, _DB_USERNAME, _DB_PASSWORD);

// initialization of the database
$GLOBALS['db']->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$GLOBALS['db']->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$GLOBALS['db']->exec('set names "utf8"');
$GLOBALS['db']->exec('set character set "utf8"');