Commit 89ae27da authored by thibaut-felten's avatar thibaut-felten

Config

parent f72b8878
......@@ -14,14 +14,14 @@ class DatabaseConnector {
protected static function createPDO() {
// $db = new PDO("sqlite::memory");
$connectionString = "mysql:host=". DB_HOST;
$connectionString = "mysql:host=". _MYSQL_HOST;
if(defined('_MYSQL_PORT'))
$connectionString .= ";port=". DB_PORT;
$connectionString .= ";port=". _MYSQL_PORT;
$connectionString .= ";dbname=" . DB_DATABASE;
$connectionString .= ";dbname=" . _MYSQL_DATABASE;
static::$pdo = new PDO($connectionString,DB_USERNAME,DB_PASSWORD);
static::$pdo = new PDO($connectionString,_MYSQL_USERNAME,_MYSQL_PASSWORD);
static::$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
}
\ No newline at end of file
......@@ -37,5 +37,3 @@ class UsersController {
return $response;
}
}
}
\ No newline at end of file
......@@ -3,20 +3,4 @@ define('_MYSQL_HOST','localhost');
define('_MYSQL_PORT',3306);
define('_MYSQL_DBNAME','dbtest');
define('_MYSQL_USER','root');
define('_MYSQL_PASSWORD','root');
$connectionString = "mysql:host=". _MYSQL_HOST;
if(defined('_MYSQL_PORT'))
$connectionString .= ";port=". _MYSQL_PORT;
$connectionString .= ";dbname=" . _MYSQL_DBNAME;
$options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8' );
try {
$pdo = new PDO($connectionString,_MYSQL_USER,_MYSQL_PASSWORD,$options);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch (PDOException $erreur) {
myLog('Erreur : '.$erreur->getMessage());
}
\ No newline at end of file
define('_MYSQL_PASSWORD','root');
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment