private function __construct($db, $db_host = null, $db_user = null, $db_password = null) { self::$db = $db; $dsn = 'mysql:host=' . ($db_host ? $db_host : DB_HOST) . ';dbname=' . ($db ? $db : DB_NAME); $this->pdo = new custom_pdo_class($dsn, $db_user ? $db_user : DB_USER, $db_password ? $db_password : DB_PASSWORD); $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $this->pdo->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_TO_STRING); $this->pdo->exec("SET sql_mode = ''"); $this->pdo->exec("SET NAMES utf8"); }
function __construct($table, $db = null, $user = null, $password = null) { $this->pdo = db_connect_class::getInstance($db ? $db : DB_NAME)->pdo; $this->table = $table; $this->init(); }