Connection.php

<?php namespace Seu\Namespace; class Connection { /** * @var \PDO */ protected $pdo; public function __construct(array $config = array()) { try { $this->pdo = new \PDO( "{$config['driver']}:host={$config['host']};dbname={$config['dbname']}", $config['user'], $config['pass'], array( \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION ) ); } catch(\PDOException $ex) { die('Erro ao conectar: ' . $ex->getMessage()); } } /** * @return \PDO Objeto PDO */ public function getPDO() { return $this->pdo; } }
Classe para conexão com banco de dados e Inserção de Clientes

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.