Skip to content

Instantly share code, notes, and snippets.

@seriiserii825
Created October 11, 2017 07:56
Show Gist options
  • Save seriiserii825/2ddb6211ed8194b760a11398bb1fa040 to your computer and use it in GitHub Desktop.
Save seriiserii825/2ddb6211ed8194b760a11398bb1fa040 to your computer and use it in GitHub Desktop.
pdo
$option = [
\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
\PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC,
\PDO::ATTR_EMULATE_PREPARES => false
];
try{
$this->dbh = new \PDO('mysql:host=127.0.0.1;dbname=stepantev', 'root', 'root', $option);
$this->dbh->exec('set charset UTF8');
}
catch (\PDOException $e){
throw new \App\Exceptions\Db($e->getMessage());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment